Original project: https://github.com/akospasztor/stm32-bootloader
Modified by CEP to support STM32L452
- Initialize peripherals (HAL, Clock, GPIO, SPI, UART, FATFS)
- Print Bootloader Information
- Mount SD Card
- On presence of firmware file on the SD card
- Erase Application space on Flash memory
- Write firmware file content on Flash memory
- Verify rightness of the written content
- Erase firmware file from SD card
- Any error in previous steps cancel the flashing procedure
- Unmount SD Card
- De-Initialize peripherals (HAL, Clock, GPIO, SPI, UART, FATFS)
- Jump to application
The firmware file must be called Scale.bin
and must be located at the root of the SD Card
On the application code (not bootloader)
In system_stm32l4xx.c
, you must update VECT_TAB_OFFSET
to 0x8000
In STM32L452RETX_FLASH.ld
, you must update the memory definition to
/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 160K
FLASH (rx) : ORIGIN = 0x8008000, LENGTH = 480K
}