4. Boot modes
At startup, the BOOT0 pin or option bit (based on the value of the BOOT_SEL option bit) and BOOTADD[31:8] option bytes are used to select the boot memory address that includes:
- • Boot from any address in user flash memory, excluding EDATA sectors.
- • Boot from system memory
- – Bootloader
When boot from user flash is selected, the boot address is defined by BOOTADD. This address can be locked thanks to BOOT_LOCK.
Embedded bootloader
The embedded bootloader is located in the system memory and is programmed by ST during production. It is used to reprogram the flash memory using USART, SPI, FDCAN, or USB in device mode through the DFU (device firmware upgrade).
Refer to the application note STM32 microcontroller system memory boot mode (AN2606).
4.1 STM32C5 boot modes
The following table provides the details of the boot mode for the STM32C5 devices.
Table 13. STM32C5 boot modes
| RDP_LEVEL | BOOT_SEL option bit | BOOT0 option bit | BOOT0 pin | EMPTY flag value(1) | Boot area |
|---|---|---|---|---|---|
| Level 0 | 1 | x | 0 | x | Boot address defined by user option byte BOOTADD[31:8] |
| 1 | Bootloader | ||||
| 0 | 0 | x | 0 | Boot address defined by user option byte BOOTADD[31:8] | |
| 1 | Bootloader | ||||
| 1 | x | Bootloader | |||
| Level 2 with boundary scan and level 2 | x | x | x | x | Boot address defined by user option byte BOOTADD[31:8] |
1. The boot address, defined by BOOTADD option byte, is considered empty only if the FLASH word is equal to 0xFFFF FFFF. In this case, at option byte loading, the EMPTY bit is set in FLASH_ACR.
Empty check
During the option byte loading phase, after loading all options, the flash memory interface checks whether the boot location in the main memory, indicated by BOOTADD[31:8], is programmed. The result of this check, with the boot0 information, is used to determine where the system should boot from. It prevents the system from booting from the main flash memory area when, for instance, no user code has been programmed.
The main flash memory empty check status can be read from the EMPTY bit in the FLASH access control register (FLASH_ACR). Software can modify it by writing an appropriate value to the EMPTY bit.
The BOOT_LOCK, which locks modifications of option bytes involved in BOOT selection, has no impact on this empty check mechanism
Embedded bootloader
The embedded bootloader is located in the system memory, programmed by ST during production. It is used to reprogram the flash memory by using USART, SPI, FDCAN, or USB in device mode through the DFU (device firmware upgrade).
For further information, refer to the application note STM32 microcontroller system memory boot mode (AN2606).