From f82680da770a35b111f4ef71f4a21caa68e6fd88 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 11 Jul 2013 23:00:24 +0000 Subject: added support for config read for 16f1847 git-svn-id: https://svn.spreadspace.org/pic/trunk@83 a09c6847-51d9-44de-8ef2-e725cf50f3c7 --- bootloader/downloader.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'bootloader/downloader.py') 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= write to flash (use '-' for stdin). --verify= compare flash with (use '-' for stdin). --read= read flash and store in (use '-' for stdout). + --read-config= read the configuration word 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 -- cgit v1.2.3