44# vim: sw=4:ts=4:si:et:enc=utf-8
55
66# Author: Ivan A-R <[email protected] > 7- # Project page: http ://tuxotronic.org/wiki/projects /stm32loader
7+ # GitHub repository: https ://github.com/jsnyder /stm32loader
88#
99# This file is part of stm32loader.
1010#
@@ -338,7 +338,7 @@ def _encode_address(address):
338338
339339
340340def usage ():
341- print ( """Usage: %s [-hqVewvr] [-l length] [-p port] [-b baud] [-a address] [-g address] [file.bin]
341+ help_text = """Usage: %s [-hqVewvr] [-l length] [-p port] [-b baud] [-a address] [-g address] [file.bin]
342342 -h This help
343343 -q Quiet
344344 -V Verbose
@@ -353,8 +353,9 @@ def usage():
353353 -g address Address to start running at (0x08000000, usually)
354354
355355 ./stm32loader.py -e -w -v example/main.bin
356-
357- """ % sys .argv [0 ])
356+ """
357+ help_text = help_text % sys .argv [0 ]
358+ print (help_text )
358359
359360
360361if __name__ == "__main__" :
@@ -379,9 +380,8 @@ def usage():
379380 'go_address' : - 1 ,
380381 }
381382
382- # http://www.python.org/doc/2.5.2/lib/module-getopt.html
383-
384383 try :
384+ # parse command-line arguments using getopt
385385 opts , args = getopt .getopt (sys .argv [1 :], "hqVewvrp:b:a:l:g:" )
386386 except getopt .GetoptError as err :
387387 # print help information and exit:
@@ -434,11 +434,6 @@ def usage():
434434 debug (0 , "Bootloader version %X" % boot_version )
435435 device_id = interface .get_id ()
436436 debug (0 , "Chip id: 0x%x (%s)" % (device_id , CHIP_IDS .get (device_id , "Unknown" )))
437- # interface.get_version()
438- # interface.get_id()
439- # interface.readout_unprotect()
440- # interface.write_unprotect()
441- # interface.write_protect([0, 1])
442437
443438 binary_data = None
444439 data_file = args [0 ] if args else None
0 commit comments