DFU (Device Firmware Upgrade) is the standard method to upload new code to a STM32 MCU via USB.
There are two different DFU bootloader which require different software:
- custom Luftboot/KroozSD bootloader which uses stm32_mem.py script
- native (embedded in ROM) dfu bootloader which requires dfu-util
To use custom DFU bootloader via USB as default:
stm32_mem.py will be used to upload the code.
To get a list of possible options, run:
Native DFU bootloader (embedded in ROM)
STM32F4 MCUs have a bootloader already embedded in the ROM.
The MCU will not go automatically in DFU mode.
To trigger DFU mode, connect pin BOOT0 with 3V (if it dowsn't work also connect BOOT1 with GND), Reset MCU, disconnect BOOT0 (and BOOT1).
For further information, look at the STM's Application note
To use ROM based DFU via USB as default:
dfu-util packet is needed for this bootloader.
Present in the current Ubuntu and Debian repo:
sudo apt-get install dfu-util
More information about dfu-util can be found at their Homepage http://dfu-util.gnumonks.org