comparison python/utils/hexfile.py @ 306:b145f8e6050b

Start on c3 rewrite
author Windel Bouwman
date Mon, 09 Dec 2013 19:00:21 +0100
parents 534b94b40aa8
children 67a584582aee
comparison
equal deleted inserted replaced
305:0615b5308710 306:b145f8e6050b
79 self.startAddress = struct.unpack('>I', data[0:4])[0] 79 self.startAddress = struct.unpack('>I', data[0:4])[0]
80 else: 80 else:
81 raise HexFileException('record type {0} not implemented'.format(typ)) 81 raise HexFileException('record type {0} not implemented'.format(typ))
82 82
83 def __repr__(self): 83 def __repr__(self):
84 size = sum(len(r.data) for r in self.regions) 84 size = sum(r.Size for r in self.regions)
85 return 'Hexfile containing {} bytes'.format(size) 85 return 'Hexfile containing {} bytes'.format(size)
86 86
87 def dump(self): 87 def dump(self):
88 print(self) 88 print(self)
89 for r in self.regions: 89 for r in self.regions:
148 148
149 def addData(self, d): 149 def addData(self, d):
150 self.data = self.data + d 150 self.data = self.data + d
151 151
152 @property 152 @property
153 def Size(self):
154 return len(self.data)
155
156 @property
153 def EndAddress(self): 157 def EndAddress(self):
154 return self.address + len(self.data) 158 return self.address + len(self.data)