|
@ -125,11 +125,13 @@ if __name__ == "__main__": |
|
|
parser = argparse.ArgumentParser() |
|
|
parser = argparse.ArgumentParser() |
|
|
parser.add_argument("progfile", help="Binary file to program") |
|
|
parser.add_argument("progfile", help="Binary file to program") |
|
|
parser.add_argument("-s", "--serial_target", help="Match Serial Number") |
|
|
parser.add_argument("-s", "--serial_target", help="Match Serial Number") |
|
|
|
|
|
parser.add_argument("-m", "--manifest", help="Start application, if in DFU mode", action='store_true') |
|
|
args = parser.parse_args() |
|
|
args = parser.parse_args() |
|
|
dfudev = stm32_scan(args) |
|
|
dfudev = stm32_scan(args) |
|
|
try: |
|
|
try: |
|
|
state = dfudev.get_state() |
|
|
state = dfudev.get_state() |
|
|
except: |
|
|
except: |
|
|
|
|
|
if args.manifest : exit(0) |
|
|
print "Failed to read device state! Assuming APP_IDLE" |
|
|
print "Failed to read device state! Assuming APP_IDLE" |
|
|
state = dfu.STATE_APP_IDLE |
|
|
state = dfu.STATE_APP_IDLE |
|
|
if state == dfu.STATE_APP_IDLE: |
|
|
if state == dfu.STATE_APP_IDLE: |
|
@ -145,6 +147,10 @@ if __name__ == "__main__": |
|
|
if timeout > 5 : |
|
|
if timeout > 5 : |
|
|
print "Error: DFU device did not appear" |
|
|
print "Error: DFU device did not appear" |
|
|
exit(-1) |
|
|
exit(-1) |
|
|
|
|
|
if args.manifest : |
|
|
|
|
|
stm32_manifest(dfudev) |
|
|
|
|
|
print "Invoking Application Device" |
|
|
|
|
|
exit(0) |
|
|
dfudev.make_idle() |
|
|
dfudev.make_idle() |
|
|
bin = open(args.progfile, "rb").read() |
|
|
bin = open(args.progfile, "rb").read() |
|
|
|
|
|
|
|
|