CVS: python/msp430 util.py,1.1,1.2
Chris Liechti <[email protected]>
| Newsgroups | gmane.comp.hardware.texas-instruments.msp430.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/mspgcc/python/msp430
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2938/python/msp430
Modified Files:
util.py
Log Message:
ihex generator: fix checksum for line types != 0
Index: util.py
===================================================================
RCS file: /cvsroot/mspgcc/python/msp430/util.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- util.py 29 Feb 2004 23:06:36 -0000 1.1
+++ util.py 9 Jul 2004 23:18:42 -0000 1.2
@@ -21,7 +21,7 @@
ascii = ''
if count < 16: print " "*(16-count), " ", ascii
-def makeihex( (address, data) ):
+def makeihex((address, data), eof=1):
"""work though the data and output lines in inzel hex format.
and end tag is appended"""
start = 0
@@ -31,12 +31,13 @@
_ihexline(address, [ord(x) for x in data[start:end]])
start += 16
address += 16
+ if eof:
_ihexline(address, [], type=1) #append no data but an end line
def _ihexline(address, buffer, type=0):
"""encode one line, output with checksum"""
sys.stdout.write( ':%02X%04X%02X' % (len(buffer), address & 0xffff, type) )
- sum = len(buffer) + ((address >> 8) & 255) + (address & 255)
+ sum = len(buffer) + ((address >> 8) & 255) + (address & 255) + (type&255)
for b in buffer:
if b == None: b = 0 #substitute nonexistent values with zero
sys.stdout.write('%02X' % (b & 255))
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com