mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-30 03:27:33 +08:00
[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:
committed by
Felix Ruess
parent
49059f0880
commit
3e689f0ce6
Executable → Regular
+12
-2
@@ -29,6 +29,7 @@ from optparse import OptionParser
|
|||||||
|
|
||||||
import usb
|
import usb
|
||||||
import dfu
|
import dfu
|
||||||
|
import time
|
||||||
|
|
||||||
APP_ADDRESS = 0x08002000
|
APP_ADDRESS = 0x08002000
|
||||||
SECTOR_SIZE = 2048
|
SECTOR_SIZE = 2048
|
||||||
@@ -101,7 +102,13 @@ if __name__ == "__main__":
|
|||||||
if options.verbose:
|
if options.verbose:
|
||||||
print_copyright()
|
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:
|
if not devs:
|
||||||
print("No DFU devices found!")
|
print("No DFU devices found!")
|
||||||
exit(1)
|
exit(1)
|
||||||
@@ -186,8 +193,11 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
#addr = APP_ADDRESS
|
#addr = APP_ADDRESS
|
||||||
addr = options.addr
|
addr = options.addr
|
||||||
|
print ("Programming memory from 0x%08X...\r" % addr)
|
||||||
|
|
||||||
while bin:
|
while bin:
|
||||||
print("Programming memory at 0x%08X\r" % addr)
|
# print("Programming memory at 0x%08X\r" % addr),
|
||||||
|
print('#', end="")
|
||||||
stdout.flush()
|
stdout.flush()
|
||||||
stm32_erase(target, addr)
|
stm32_erase(target, addr)
|
||||||
stm32_write(target, bin[:SECTOR_SIZE])
|
stm32_write(target, bin[:SECTOR_SIZE])
|
||||||
|
|||||||
Reference in New Issue
Block a user