[tools] update dfu script

- add a timeout so you have time to connect the device
- less verbose, don't print all addresses
This commit is contained in:
Sergey Krukovski
2013-05-12 23:24:23 +02:00
committed by Felix Ruess
parent 49059f0880
commit 3e689f0ce6
Executable → Regular
+12 -2
View File
@@ -29,6 +29,7 @@ from optparse import OptionParser
import usb
import dfu
import time
APP_ADDRESS = 0x08002000
SECTOR_SIZE = 2048
@@ -101,7 +102,13 @@ if __name__ == "__main__":
if options.verbose:
print_copyright()
devs = dfu.finddevs()
for i in range(1,60):
devs = dfu.finddevs()
if not devs:
print('.', end="")
stdout.flush()
time.sleep(0.5)
print("")
if not devs:
print("No DFU devices found!")
exit(1)
@@ -186,8 +193,11 @@ if __name__ == "__main__":
#addr = APP_ADDRESS
addr = options.addr
print ("Programming memory from 0x%08X...\r" % addr)
while bin:
print("Programming memory at 0x%08X\r" % addr)
# print("Programming memory at 0x%08X\r" % addr),
print('#', end="")
stdout.flush()
stm32_erase(target, addr)
stm32_write(target, bin[:SECTOR_SIZE])