Hi,
There is a bug in the file python-mspgcc-tools/mspgcc/memory.py - the
Intel Hex file loader can interpret line type 0x02 for extended memory
addressing, but not line type 0x04. Code Composer Studio uses type 0x04
("Extended Linear Address Record") rather than type 0x02 ("Extended
Segment Address Record") in the hex files it generates. Since the
"loadIHex" function in memory.py currently ignores type 0x04 records, it
effectively relocates addresses 0x10000... to 0x00000..., and
programming via msp430-bsl.py fails.
The fix is very simple. I'm afraid I don't know anything about bazaar
(it took me longer to figure out how to get the latest copy of the code
via bazaar than it took me to find and fix the bug...). But I hope that
by posting the fix here, someone will add it to the repository.
The corrected "loadIHex" function is shown below. Email mangles the
line endings and white spaces, but it's easy to see the two additional
lines at about line 78 in "memory.py" that handle type 0x04 records.
I haven't looked at any other files in the project that may read Intel
Hex files, in case anything else needs to be changed.
mvh.,
David
def loadIHex(self, file):
"""load data from a (opened) file in Intel-HEX format"""
segmentdata = []
currentAddr = 0
startAddr = 0
extendAddr = 0
lines = file.readlines()
for l in lines:
if not l.strip(): continue #skip empty lines
if l[0] != ':': raise FileFormatError("line not valid intel
hex data: '%s...'" % l[0:10])
l = l.strip() #fix CR-LF issues...
length = int(l[1:3],16)
address = int(l[3:7],16) + extendAddr
type = int(l[7:9],16)
check = int(l[-2:],16)
if type == 0x00:
if currentAddr != address:
if segmentdata:
self.segments.append( Segment(startAddr,
''.join(segmentdata)) )
startAddr = currentAddr = address
segmentdata = []
for i in range(length):
segmentdata.append( chr(int(l[9+2*i:11+2*i],16)) )
currentAddr = length + currentAddr
elif type == 0x02:
extendAddr = int(l[9:13],16) << 4
elif type == 0x04 :
extendAddr = int(l[9:13], 16) << 16
elif type in (0x01, 0x03, 0x04, 0x05):
pass
else:
sys.stderr.write("Ignored unknown field (type 0x%02x)
in ihex file.\n" % type)
if segmentdata:
self.segments.append( Segment(startAddr,
''.join(segmentdata)) )
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users