for an automated CI/CD process I would like to be able to run the following sequence without the need for manual operation:
preferably on windows , but ubuntu is fine if required.
1. set board in bootloader mode
2. download a new firmware v1.xx with dfu-util
3. reset/restart the board
4. upload some scripts
5. run a set up tests
6. download the results
I can get all steps to work , apart from the reset of the board after dfu-util has loaded the new firmware.
setup :
- windows 10/11
- zadig WinUSB(libusb) driver installed ( also tried with libusbK driver to no avail)
- pyboard.py to set the board in pyb.bootloader() mode
- dfu-util version 0.9
- .\Tools\dfu-util\dfu-util.exe --device 0483:df11 --alt 0 --download $filename_dfu
the --reset option and -E eject options do not work as I had expected/hoped.
I assume that a similar config is used in other micropython projects, and hope that someone can share a solution to this,
howto automatically restart a Pybv11 after flashing
Re: howto automatically restart a Pybv11 after flashing
If you pass the arguments "-s :leave" to dfu-util, it will cause the DFU boot loader to be exited after flashing. I commonly do this by creating a GNUmakefile in my ports/stm32 directory which has the following contents: then when you do a "make deploy" it will flash your program, and then reboot after flashing.
Code: Select all
$(info Executing GNUmakefile)
DFU_UTIL = dfu-util -s :leave
USE_PYDFU = 0
include Makefile
Re: howto automatically restart a Pybv11 after flashing
Thanks Dave,
Works like a charm on Windows as well
For me the process is a bit different , but the same parameters work for my scenario.
Knowing the answer :
I was able to refomulate my question to the search engines and find a source for these -s :MODIFIERS
Works like a charm on Windows as well
For me the process is a bit different , but the same parameters work for my scenario.
Code: Select all
$filename = "./PYB_11/pybv11-network-20210902-v1.17.dfu"
$serialport = "COM7"
# Put device into bootloader mode
python .\Tools\pyboard.py -d $serialPort --command "import time;time.sleep_ms(200);import pyb;pyb.bootloader()" --no-follow
# Flash
dfu-util.exe --device 0483:df11 --alt 0 -s :leave --download $filename --reset
# Erase and Flash
# dfu-util.exe --device 0483:df11 --alt 0 -s :mass-erase:force:leave --download $filename --reset
I was able to refomulate my question to the search engines and find a source for these -s :MODIFIERS
- The best documentation I could find on these modifiers is in the dfu-util man page , which for Windows users is not that obvious ,
https://github.com/GGLinnk/dfu-util/blo ... #L249-L252
- I assume that relates to table 4 in the STM32 specs: https://www.st.com/resource/en/applicat ... ronics.pdf