summaryrefslogtreecommitdiff
path: root/downloader/downloader.py
diff options
context:
space:
mode:
Diffstat (limited to 'downloader/downloader.py')
-rwxr-xr-xdownloader/downloader.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/downloader/downloader.py b/downloader/downloader.py
index 86a41c9..8c5f15c 100755
--- a/downloader/downloader.py
+++ b/downloader/downloader.py
@@ -61,12 +61,17 @@ def get_highest_flash_addr(codedata, fss):
def create_flash_image(codedata, fss, sa, ea):
img = ( sa, [0xFFFF]*(ea-sa) )
for a,d in codedata.items():
- img[1][a-sa] = d
+ if a < ea:
+ img[1][a-sa] = d
return img
-def create_flash_segments(codedata, fss):
+def create_flash_segments(codedata, fs, fss):
sa = get_lowest_flash_addr(codedata, fss)
ea = get_highest_flash_addr(codedata, fss)
+ if ea >= fs:
+ print "WARNING: the hex file contains data after end of flash, these words will be ignored"
+ ea = fs
+
img = create_flash_image(codedata, fss, sa, ea)
for i in xrange(0, ea, fss):
slice = img[1][i:i+fss]
@@ -169,7 +174,7 @@ def identify(dev):
print "FSS value is 0 "
sys.exit(4)
- print "connected with Bootloader '%s' Version %d.%d, (ID=%04X, %d bytes Flash, FSS=%d, %d bytes EEPROM, MESS=%d)" % \
+ print "connected with Bootloader '%s' Version %d.%d, (ID=%04X, %d words Flash, FSS=%d, %d bytes EEPROM, MESS=%d)" % \
(id['name'], id['ver_maj'], id['ver_min'], id['devid'], id['fs'], id['fss'], id['es'], id['mess'])
return id
@@ -262,5 +267,5 @@ Options:
codedata = load_hex(args[0])
id = identify(dev)
- # for segment in create_flash_segments(codedata, id['fss']):
- # print "%05X: %s" % (segment[0], ''.join('%04X'%i for i in segment[1]))
+ for segment in create_flash_segments(codedata, id['fs'], id['fss']):
+ print "%05X: %s" % (segment[0], ''.join('%04X'%i for i in segment[1]))