view python/serve_arm_as.py @ 271:cf7d5fb7d9c8

Reorganization
author Windel Bouwman
date Tue, 20 Aug 2013 18:56:02 +0200
parents c352dec19299
children
line wrap: on
line source


import subprocess
import tornado.web


def mangle(inp):
    p_as = subprocess.Popen(['arm-elf-as', '-mthumb'], stdin=subprocess.PIPE)
    p_as.communicate(input=inp.encode('ascii'))

    p_objdump = subprocess.Popen(['arm-elf-objdump', '-d'], stdout=subprocess.PIPE)
    output = p_objdump.communicate()[0].decode('ascii')
    print(output)

    p_objdump = subprocess.Popen(['arm-elf-objdump', '-s'], stdout=subprocess.PIPE)
    output = p_objdump.communicate()[0].decode('ascii')
    print(output)

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write('Hello')

if __name__ == '__main__':
    inp = """add r1, r2, r3
    """
    inp2 = """blt henkie
    bgt henkie
    henkie:
    """
    mangle(inp2)