diff python/outstream.py @ 236:8786811a5a59

Fix pcrel
author Windel Bouwman
date Mon, 15 Jul 2013 20:15:31 +0200
parents ff40407c0240
children 81752b0f85a5
line wrap: on
line diff
--- a/python/outstream.py	Mon Jul 15 17:20:37 2013 +0200
+++ b/python/outstream.py	Mon Jul 15 20:15:31 2013 +0200
@@ -48,6 +48,7 @@
 
     def dump(self):
         self.backpatch()
+        self.backpatch()
         for s in sorted(self.sections.keys()):
             self.dumpSection(s)
 
@@ -71,3 +72,23 @@
     def dump(self):
         pass
 
+    @property
+    def Data(self):
+        d = self.dump()
+        return bytes(d)
+
+    def dump(self):
+        self.backpatch()
+        self.backpatch()
+        section = list(self.sections.keys())[0]
+        return self.dumpSection(section)
+
+    def dumpSection(self, s):
+        d = bytearray()
+        for i in self.sections[s]:
+            addr = i.address
+            insword = i.encode()
+            assert type(insword) is bytes
+            d.extend(insword)
+        return d
+