comparison python/ppci/outstream.py @ 346:3bb7dcfe5529

expanded arm target
author Windel Bouwman
date Fri, 07 Mar 2014 17:05:32 +0100
parents 86b02c98a717
children 442fb043d149
comparison
equal deleted inserted replaced
345:b4882ff0ed06 346:3bb7dcfe5529
1 import binascii 1 import binascii
2 from ppci.target import Instruction, DebugInfo, Alignment 2 from ppci.target import Instruction, Alignment
3 from ppci.objectfile import ObjectFile 3 from ppci.objectfile import ObjectFile
4 4
5 """ 5 """
6 The output stream is a stream of instructions that can be output 6 The output stream is a stream of instructions that can be output
7 to a file or binary or hexfile. 7 to a file or binary or hexfile.
25 # print('.section '+ s) 25 # print('.section '+ s)
26 self.dumpSection(stream.sections[s], f) 26 self.dumpSection(stream.sections[s], f)
27 27
28 def dumpSection(self, s, f): 28 def dumpSection(self, s, f):
29 for i in s.instructions: 29 for i in s.instructions:
30 if type(i) is DebugInfo:
31 continue
32 addr = i.address 30 addr = i.address
33 insword = i.encode() 31 insword = i.encode()
34 assert type(insword) is bytes 32 assert type(insword) is bytes
35 insword = binascii.hexlify(bytes(reversed(insword))).decode('ascii') 33 insword = binascii.hexlify(bytes(reversed(insword))).decode('ascii')
36 asm = str(i) 34 asm = str(i)