This commit makes it possible to provide function level msos GUIDs to usb_dfu. This helps to ensure that composite DFU devices automatically get assigned the WinUSB driver on Windows.
Bootloader for STM32
This bootloader implementation uses embassy-boot and embassy-usb-dfu to manage firmware updates and interact with the flash memory on STM32WB55 devices.
Prerequisites
- Rust toolchain with
cargoinstalled cargo-flashfor flashing the bootloaderdfu-utilfor firmware updatescargo-binutilsfor binary generation
Usage
1. Flash the Bootloader
First, flash the bootloader to your device:
cargo flash --features embassy-stm32/stm32wb55rg --release --chip STM32WB55RGVx
2. Build and Flash Application
Generate your application binary and flash it using DFU:
cargo objcopy --release -- -O binary fw.bin
dfu-util -d c0de:cafe -w -D fw.bin
Troubleshooting
- Make sure your device is in DFU mode before flashing
- Verify the USB VID:PID matches your device (c0de:cafe)
- Check USB connections if the device is not detected
- Make sure the transfer size option of
dfu-utilmatches the bootloader configuration. By default,dfu-utilwill use the transfer size reported by the device, but you can override it with the-toption if needed. - Make sure
control_bufsize is larger than or equal to theusb_dfuBLOCK_SIZEparameter (in this example, both are set to 4096 bytes).