diff python/ppci/buildtasks.py @ 336:d1ecc493384e

Added spiffy armtoken class for bit fiddeling. Added cool test that checks for build repeatability
author Windel Bouwman
date Wed, 19 Feb 2014 22:32:15 +0100
parents 582a1aaa3983
children b00219172a42
line wrap: on
line diff
--- a/python/ppci/buildtasks.py	Mon Feb 17 20:41:30 2014 +0100
+++ b/python/ppci/buildtasks.py	Wed Feb 19 22:32:15 2014 +0100
@@ -31,10 +31,12 @@
     def __init__(self, source, target, output_object):
         super().__init__('Assemble')
         self.source = source
-        self.assembler = Assembler(target=target)
         self.output = output_object
+        self.ostream = outstream.BinaryOutputStream(self.output)
+        self.assembler = Assembler(target, self.ostream)
 
     def run(self):
+        self.ostream.selectSection('code')
         self.assembler.assemble(self.source)
 
 
@@ -82,16 +84,22 @@
 
 class Link(BuildTask):
     """ Link together a collection of object files """
-    def __init__(self, objects, output_file):
+    def __init__(self, objects, layout, output_file):
         super().__init__('Link')
         self.objects = objects
         self.linker = Linker()
         self.duration = 0.1337
+        self.layout = layout
+        self.output_file = output_file
 
     def run(self):
-        self.linker.link(self.objects)
+        output_obj = self.linker.link(self.objects, self.layout)
+        code = output_obj.get_section('code').data
+        with open(self.output_file, 'wb') as f:
+            f.write(code)
 
 
-class ObjCopy(Task):
-    pass
+class ObjCopy(BuildTask):
+    def __init__(self, objects, output_file):
+        super().__init__('ObjCopy')