view python/serve_arm_as.py @ 272:e64bae57cda8

refactor ir
author Windel Bouwman
date Sat, 31 Aug 2013 17:58:54 +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)