annotate 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
rev   line source
263
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
1
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
2 import subprocess
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
3 import tornado.web
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
4
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
5
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
6 def mangle(inp):
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
7 p_as = subprocess.Popen(['arm-elf-as', '-mthumb'], stdin=subprocess.PIPE)
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
8 p_as.communicate(input=inp.encode('ascii'))
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
9
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
10 p_objdump = subprocess.Popen(['arm-elf-objdump', '-d'], stdout=subprocess.PIPE)
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
11 output = p_objdump.communicate()[0].decode('ascii')
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
12 print(output)
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
13
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
14 p_objdump = subprocess.Popen(['arm-elf-objdump', '-s'], stdout=subprocess.PIPE)
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
15 output = p_objdump.communicate()[0].decode('ascii')
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
16 print(output)
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
17
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
18 class MainHandler(tornado.web.RequestHandler):
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
19 def get(self):
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
20 self.write('Hello')
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
21
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
22 if __name__ == '__main__':
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
23 inp = """add r1, r2, r3
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
24 """
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
25 inp2 = """blt henkie
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
26 bgt henkie
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
27 henkie:
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
28 """
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
29 mangle(inp2)
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
30
c352dec19299 Added gcc arm runner
Windel Bouwman
parents:
diff changeset
31