stm32_mem: Allow to switch from dfu to application without flashing.

This commit is contained in:
Uwe Bonnes 2017-09-28 13:01:59 +02:00
parent c41dfaef9a
commit 613208c939
1 changed files with 6 additions and 0 deletions

View File

@ -125,11 +125,13 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("progfile", help="Binary file to program")
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()
dfudev = stm32_scan(args)
try:
state = dfudev.get_state()
except:
if args.manifest : exit(0)
print "Failed to read device state! Assuming APP_IDLE"
state = dfu.STATE_APP_IDLE
if state == dfu.STATE_APP_IDLE:
@ -145,6 +147,10 @@ if __name__ == "__main__":
if timeout > 5 :
print "Error: DFU device did not appear"
exit(-1)
if args.manifest :
stm32_manifest(dfudev)
print "Invoking Application Device"
exit(0)
dfudev.make_idle()
bin = open(args.progfile, "rb").read()