aboutsummaryrefslogtreecommitdiffstats
path: root/support/stm32loader.py
diff options
context:
space:
mode:
Diffstat (limited to 'support/stm32loader.py')
-rwxr-xr-xsupport/stm32loader.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/support/stm32loader.py b/support/stm32loader.py
index 02ca4e8..874d278 100755
--- a/support/stm32loader.py
+++ b/support/stm32loader.py
@@ -74,13 +74,12 @@ class CommandInterface:
if ask == 0x79:
# ACK
return 1
- else:
- if ask == 0x1F:
- # NACK
- raise CmdException("Chip replied with a NACK during %s" % info)
- else:
- # Unknown responce
- raise CmdException("Unrecognised response %x to %s" % (ask, info))
+ elif ask == 0x1F:
+ # NACK
+ raise CmdException("Chip replied with a NACK during %s" % info)
+
+ # Unknown response
+ raise CmdException("Unrecognised response 0x%x to %s" % (ask, info))
def reset(self):
self.sp.setDTR(0)
@@ -93,7 +92,7 @@ class CommandInterface:
self.sp.setRTS(0)
self.reset()
- # Be a bit more persistant when trying to initialise the chip
+ # Be a bit more persistent when trying to initialise the chip
stop = time.time() + 5.0
while time.time() <= stop:
@@ -276,7 +275,7 @@ class CommandInterface:
if usepbar:
widgets = ['Reading: ', Percentage(),', ', ETA(), ' ', Bar()]
pbar = ProgressBar(widgets=widgets,maxval=lng, term_width=79).start()
-
+
while lng > 256:
if usepbar:
pbar.update(pbar.maxval-lng)
@@ -298,7 +297,7 @@ class CommandInterface:
if usepbar:
widgets = ['Writing: ', Percentage(),' ', ETA(), ' ', Bar()]
pbar = ProgressBar(widgets=widgets, maxval=lng, term_width=79).start()
-
+
offs = 0
while lng > 256:
if usepbar:
@@ -319,7 +318,7 @@ class CommandInterface:
- def __init__(self) :
+ def __init__(self) :
pass
@@ -371,7 +370,7 @@ def read(filename):
return [ord(x) for x in bytes]
if __name__ == "__main__":
-
+
# Import Psyco if available
try:
import psyco
@@ -449,7 +448,8 @@ if __name__ == "__main__":
cmd = CommandInterface()
cmd.open(conf['port'], conf['baud'])
- mdebug(10, "Open port %(port)s, baud %(baud)d" % {'port':conf['port'], 'baud':conf['baud']})
+ mdebug(10, "Open port %(port)s, baud %(baud)d" % {'port':conf['port'],
+ 'baud':conf['baud']})
try:
if (conf['write'] or conf['verify']):
data = read(args[0])
@@ -461,7 +461,7 @@ if __name__ == "__main__":
bootversion = cmd.cmdGet()
- mdebug(0, "Bootloader version %X" % bootversion)
+ mdebug(0, "Bootloader version 0x%X" % bootversion)
if bootversion < 20 or bootversion >= 100:
raise Exception('Unreasonable bootloader version %d' % bootversion)