view python/serve_arm_as.py @ 263:c352dec19299

Added gcc arm runner
author Windel Bouwman
date Fri, 09 Aug 2013 16:28:50 +0200
parents
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)