4. Boot modes

At startup, a BOOT0 pin, NBOOT0, and NSBOOTADDx[24:0]/SECBOOTADD0[24:0] option bytes are used to select the boot memory address that includes:

The BOOT0 value may come from the PH3-BOOT0 pin or from an option bit depending on the value of a user option bit to free the GPIO pad if needed.

The bootloader, located in the system memory, is used to reprogram the flash memory by using USART, I2C, SPI, FDCAN, or USB/OTG_FS/OTG_HS in device mode through the DFU (device firmware upgrade).

Table 25 and Table 26 detail the boot modes when TrustZone is disabled or enabled.

Table 25. Boot modes when TrustZone is disabled (TZEN = 0)

NBOOT0
FLASH_
OPTR[27]
BOOT0
pin PH3
NSWBOOT0
FLASH_
OPTR[26]
Boot address
option-byte selection
Boot areaST programmed
default value
-01NSBOOTADD0[24:0]Boot address defined by user option bytes NSBOOTADD0[24:0]Flash memory: 0x0800 0000
-11NSBOOTADD1[24:0]Boot address defined by user option bytes NSBOOTADD1[24:0]Bootloader: 0x0BF9 0000
1-0NSBOOTADD0[24:0]Boot address defined by user option bytes NSBOOTADD0[24:0]Flash memory: 0x0800 0000
0-0NSBOOTADD1[24:0]Boot address defined by user option bytes NSBOOTADD1[24:0]Bootloader: 0x0BF9 0000

When TrustZone is enabled by setting the TZEN option bit, the boot space must be in the secure area. The SECBOOTADD0[24:0] option bytes are used to select the boot secure memory address.

A unique boot entry option can be selected by setting the BOOT_LOCK option bit. All other boot options are ignored.

Table 26. Boot modes when TrustZone is enabled (TZEN = 1)

BOOT_LOCKNBOOT0 FLASH_OPTR[27]BOOT0 pin PH3NSWBOOT0 FLASH_OPTR[26]RSS commandBoot address option-byte selectionBoot areaST programmed default value
0-010SECBOOTADD0 [24:0]Secure boot address defined by user option bytes SECBOOTADD0[24:0]Flash memory: 0x0C00 0000
-110N/ARSSRSS: 0x0FF8 0000
1-00SECBOOTADD0 [24:0]Secure boot address defined by user option bytes SECBOOTADD0[24:0]Flash memory: 0x0C00 0000
0-00N/ARSSRSS: 0x0FF8 0000
---≠ 0N/ARSSRSS: 0x0FF8 0000
1----SECBOOTADD0 [24:0]Secure boot address defined by user option bytes SECBOOTADD0[24:0]Flash memory: 0x0C00 0000

The boot address option bytes are used to program any boot memory address. However, the allowed address space depends on flash memory read protection RDP level.

If the programmed boot memory address is out of the allowed memory mapped area when RDP level is 0.5 or more, the default boot fetch address is forced either in the secure flash memory or the nonsecure flash memory depending on the TrustZone security option as described in the table below.

Table 27. Boot space versus RDP protection

RDPTZEN = 1TZEN = 0
0Any boot addressAny boot address
0.5N/A
1Boot address only in RSS: 0x0FF80000 or in secure flash memory:Any boot address
2
  • – 0x0C00 0000-0x0C07 FFFF on STM32U535/545
  • – 0x0C00 0000-0x0C1F FFFF on STM32U575/585
  • – 0x0C00 0000-0x0C3F FFFF on STM32U59x/5Ax/5Fx/5Gx
Otherwise, the forced boot address is 0x0FF8 0000.
Boot address only in flash memory:
  • – 0x0800 0000-0x0807 FFFF on STM32U535/545
  • – 0x0800 0000-0x081F FFFF on STM32U575/585
  • – 0x0800 0000-0x083F FFFF on STM32U59x/5Ax/5Fx/5Gx
Otherwise, the forced boot address is 0x0800 0000.

The BOOT0 value (either coming from the pin or the option bit) is latched upon reset release. It is up to the user to set nBOOT0 or BOOT0 values to select the required boot mode.

The BOOT0 pin or user option bit (depending on NSWBOOT0 in FLASH_OPTR) is also resampled when exiting Standby mode. Consequently, the BOOT0 pin or user option bit must be kept in the required boot mode configuration in Standby mode. After the startup delay, the selection of the boot area is done before releasing the processor reset.

PH3/BOOT0 GPIO is configured as follows:

Embedded bootloader

The embedded bootloader is located in the system memory, programmed by ST during production. Refer to the application note STM32 microcontroller system memory boot mode (AN2606).

Embedded root security services (RSS)

The embedded RSS are located in the secure information block, programmed by ST during production. Refer to the application note STM32 MCUs secure firmware install (SFI) overview (AN4992).