summaryrefslogtreecommitdiff
path: root/bootloader/downloader.py
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2013-07-11 01:25:31 +0000
committerChristian Pointner <equinox@spreadspace.org>2013-07-11 01:25:31 +0000
commit5c682b37051797602971f78d49935c7560568aa9 (patch)
tree205fbbb64591254e62d13a54d74166113686e0ef /bootloader/downloader.py
parentadded inital support for 16f1847 (diff)
implemented reset command for 16f1847
also added support for reset at downloader git-svn-id: https://svn.spreadspace.org/pic/trunk@76 a09c6847-51d9-44de-8ef2-e725cf50f3c7
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 072ca46..bbb6d13 100755
--- a/bootloader/downloader.py
+++ b/bootloader/downloader.py
@@ -251,6 +251,10 @@ def boot(dev, id, args):
print >> sys.stderr, "booting to user code"
cmd_boot(dev)
+def reset(dev, id, args):
+ print >> sys.stderr, "reseting MCU"
+ cmd_reset(dev,id)
+
def write_flash(dev, id, args):
hexdata = load_hex(args[0])
flashsegments = list(create_flash_segments(hexdata, id['fs'], id['fss']))
@@ -306,6 +310,7 @@ def verify_flash(dev, id, args):
commands = {
'boot': boot,
+ 'reset': reset,
'write': write_flash,
'read': read_flash,
'verify': verify_flash
@@ -327,8 +332,10 @@ Usage:
may be supplied more than once. The commands will be executed in the
order of appearence in the command line.
Mind that all commands after 'boot' will be ignored because the bootloader
- is no longer reachable. If verify detects an error the downloader will
- exit with '-1' immediatly, the remaining commands will get ignored.
+ is no longer reachable. The same may be true after a reset, in which case
+ depending on the state of BOOTPIN the user code may get started.
+ If verify detects an error the downloader will exit with '-1' immediatly and
+ the remaining commands will get ignored.
If you don't specify any command the downloader will connect to the
bootloader print some info and exit.
@@ -343,6 +350,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).
+ --reset reset the MCU (this may start the user code area: BOOTPIN)
--boot boot to user code
'''
@@ -353,7 +361,7 @@ Commands:
try:
opts, args = getopt.getopt(sys.argv[1:], "hv", ["help", "version", "device=", "baud=", "name=", \
- "write=", "read=", "verify=", "boot" ])
+ "write=", "read=", "verify=", "reset", "boot" ])
for o, a in opts:
if o in ("-h", "--help"):
print >> sys.stderr, usage