How adamberlinger/stm32f103_bluepill_dfu works
This is a minimalist STM32F103 USB DFU bootloader. After reset, board boot-pin selection activates the bootloader; it initializes the MCU and USB device, handles DFU requests from a host, and erases or programs application flash. The graph includes the documented reset and memory-layout behavior, plus USB descriptors, board support, timing, and interrupt handling. Several implementation files were not excerpted, so uncertain startup and interrupt wiring is omitted rather than inferred.
Main entry points: usb_core.c USB protocol core · main.c Bootloader runtime · usb_dfu.c DFU request handling · stm32_common.h STM32 platform definitions
Components 14
Startup and MCU
- Reset activation check
src/initc.c - Bootloader runtime
src/main.c - STM32F1 registers
lib/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h - Interrupt handlers
src/stm32f1_interrupts.c
USB device
- USB protocol core
stm32x0_usb_dfu/usb_core.c - USB descriptors
stm32x0_usb_dfu/usb_desc.c - USB board support
stm32x0_usb_dfu/usb_bsp.c
DFU and flash
- DFU request handling
stm32x0_usb_dfu/usb_dfu.c - Application flash operations
stm32x0_usb_dfu/usb_dfu.c
Platform support
- Millisecond timing
src/systick.c - USB configuration
stm32x0_usb_dfu/usb_conf.h - STM32 platform definitions
src/stm32_common.h
Other components
- Boot pin jumpers
- DFU host tools
Connections 16
- Boot pin jumpers → Reset activation check: selects boot
- Reset activation check → Bootloader runtime: activates
- Bootloader runtime → USB protocol core: initializes
src/main.c - Bootloader runtime → DFU request handling: runs loop
src/main.c - Bootloader runtime → Millisecond timing: starts ticks
src/main.c - Bootloader runtime → STM32F1 registers: configures MCU
src/main.c - USB protocol core → DFU request handling: dispatches requests
stm32x0_usb_dfu/usb_core.c - USB protocol core → USB descriptors: uses descriptors
stm32x0_usb_dfu/usb_core.c - USB protocol core → USB board support: uses board support
stm32x0_usb_dfu/usb_core.c - USB protocol core → USB configuration: uses settings
stm32x0_usb_dfu/usb_core.c - USB board support → USB configuration: uses settings
- DFU request handling → USB protocol core: sends responses
stm32x0_usb_dfu/usb_dfu.c - DFU request handling → Application flash operations: erases and writes
stm32x0_usb_dfu/usb_dfu.c - DFU host tools → USB protocol core: exchanges DFU
- STM32 platform definitions → STM32F1 registers: includes definitions
src/stm32_common.h - STM32 platform definitions → Millisecond timing: includes timing API
src/stm32_common.h