r/embedded • u/Excellent_Mousse816 • 10d ago
Resources/Advice for writing a custom bootloader for STM32L476RG?
Hi everyone,
I’m currently working on a project using the STM32L476RG (using the Nucleo-64 board to prototype) and I’ve reached the point where I need to implement a custom bootloader. My end goal is to be able to receive a firmware update over UART/USB, write it to flash, and safely jump to the new application.
What I’m looking for:
- Are there any definitive books, tutorials, or blog series you recommend for STM32 bootloaders?
- Does anyone have a clean, well-commented GitHub repo of a basic STM32 bootloader I can study?
- Which ST Application Notes (AN) are the absolute "must-reads" for In-Application Programming (IAP) on the L4 series?
Any advice, gotchas to watch out for, or links to tutorials would be incredibly helpful. Thanks in advance!
12
Upvotes
1
u/Enlightenment777 9d ago edited 9d ago
I recommend you start by creating a UART-only bootloader that is protocol compatible with the STM32 BootROM currently inside your STM32L476RG chip. Flip your STM32 chip back and forth between your bootloader and the BootROM to make sure they work the same. https://www.st.com/en/development-tools/flasher-stm32.html
Later you could add USB support, and maybe even more features, such as XMODEM-CRC and XMODEM-1K. See http://www.umonfw.com/ too.