summaryrefslogtreecommitdiff
path: root/bootloader/downloader.py
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader/downloader.py')
-rwxr-xr-xbootloader/downloader.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/bootloader/downloader.py b/bootloader/downloader.py
index e214171..3d93000 100755
--- a/bootloader/downloader.py
+++ b/bootloader/downloader.py
@@ -176,7 +176,7 @@ def cmd_identify(dev, name):
print >> sys.stderr, " right device?"
sys.exit(4)
- print >> sys.stderr, "connected with Bootloader '%s' Version %d.%d,\n (ID=%04X, %d words Flash, FSS=%d, %d bytes EEPROM, MESS=%d, %d words config)\n" % \
+ print >> sys.stderr, "connected with Bootloader '%s' Version %d.%d,\n (ID=%04X, %d words Flash, FSS=%d, %d bytes EEPROM, MESS=%d, %d words Config)\n" % \
(id['name'], id['ver_maj'], id['ver_min'], id['devid'], id['fs'], id['fss'], id['es'], id['mess'], id['cfg'])
return id
@@ -305,12 +305,19 @@ def verify_flash(dev, id, args):
else:
print >> sys.stderr, " *********** verify ok! **********\n"
+def read_config(dev, id, args):
+ nr = int(args[0])
+ print >> sys.stderr, "reading configuration word nr %d" % nr
+ print "0x%04X" % cmd_read_config(dev, id, nr)
+
+
commands = {
'boot': boot,
'reset': reset,
'write': write_flash,
'read': read_flash,
- 'verify': verify_flash
+ 'verify': verify_flash,
+ 'read-config': read_config
}
### Main
@@ -346,6 +353,7 @@ Commands:
--write=<hexfile> write <hexfile> to flash (use '-' for stdin).
--verify=<hexfile> compare flash with <hexfile> (use '-' for stdin).
--read=<hexfile> read flash and store in <hexfile> (use '-' for stdout).
+ --read-config=<nr> read the configuration word <nr> and print it on stdout.
--reset reset the MCU (this may start the user code area: BOOTPIN)
--boot boot to user code
'''
@@ -357,7 +365,7 @@ Commands:
try:
opts, args = getopt.getopt(sys.argv[1:], "hv", ["help", "version", "device=", "baud=", "name=", \
- "write=", "read=", "verify=", "reset", "boot" ])
+ "write=", "read=", "verify=", "read-config=", "reset", "boot" ])
for o, a in opts:
if o in ("-h", "--help"):
print >> sys.stderr, usage