4. Boot modes

At startup, a BOOT0 pin, NBOOT0, NSWBOOT0, NSBOOTADDx/SECBOOTADD0, and TZEN option bytes are used to select the boot memory address, which includes:

The BOOT0 value may come from the PH3-BOOT0 pin or from the option bit NBOOT0, 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 program the flash memory by using USART, I2C, or SPI in device mode.

Table 22 details the boot modes when TrustZone is disabled, and Table 23 when enabled (a) .

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

BOOT0 (1)Boot address option bytes selectionBoot initial VTOR_NS
NonsecureST programmed default value
0NSBOOTADD00x0800 0000 - User flashNSBOOTADD0
1NSBOOTADD10x0BF8 8000 - BootloaderNSBOOTADD1

1. BOOT0 is either not NBOOT0 when NSWBOOT0 = 0 or pin PH3-BOOT0 when NSWBOOT0 = 1

When TrustZone is enabled by setting the TZEN option bit, the boot space must be in the secure area. The SECBOOTADD0 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. In this case, all other boot options are ignored.

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

BOOT_LOCKBOOT0 (1)RSS commandBoot address option bytes selectionBoot initial VTOR_S
SecureST programmed default valueNonsecureST programmed default value
000SECBOOTADD00x0C00 0000 - User flashNSBOOTADD00x0800 0000 (2)SECBOOTADD0
10N/A0x0FF8 0000 - RSSNSBOOTADD10x0BF8 80000x0FF8 0000
0≠ 0N/A0x0FF8 0000 - RSSNSBOOTADD00x0800 0000 (2)0x0FF8 0000
1NSBOOTADD10x0BF8 8000

a. STM32WBA52/4/5xx devices only.

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

BOOT_LOCKBOOT0 (1)RSS commandBoot address option bytes selectionBoot initial VTOR_S
SecureST programmed default valueNonsecureST programmed default value
10xSECBOOTADD00x0C00 0000 - User flashNSBOOTADD00x0800 0000 (2)SECBOOTADD0
1NSBOOTADD10x0BF8 8000 (3)
  1. 1. BOOT0 is either not NBOOT0 when NSWBOOT0 = 0 or pin PH3-BOOT0 when NSWBOOT0 = 1
  2. 2. The default NSBOOTADD0 points to a secure flash memory area, at boot privileged software must write Cortex-M33 VTOR_NS to point to a nonsecure area.
  3. 3. The default NSBOOTADD1 points to the bootloader, at boot privileged software must write Cortex-M33 VTOR_NS to point to a nonsecure user area.

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 TZEN = 0 and RDP level is 2, or when TZEN = 1 and 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 TrustZone security option, as described in Table 24 .

Table 24. Boot space versus RDP protection

RDPTZEN = 1 (1)TZEN = 0
Valid address range SECBOOTADDValid address range NSBOOTADDx
0Any boot addressAny boot address
0.5Boot address only in RSS 0x0FF8 0000 or in secure flash memory: 0x0C00 0000- 0x0C0F FFFF.
Otherwise boot address forced to RSS: 0x0FF8 0000.
N/A
1Any boot address
2Otherwise boot address forced to RSS: 0x0FF8 0000.Boot address only in flash memory: 0x0800 0000 - 0x080F FFFF.
Otherwise boot address forced to 0x0800 0000.
  1. 1. The initial NSBOOTADDx can point to a secure area. At boot, privileged software must write Cortex-M33 VTOR_NS to point to a nonsecure user area.

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

The BOOT0 pin or user option NBOOT0 (depending on NSWBOOT0 in FLASH_OPTR) is also resampled when exiting standby modes. Consequently, the BOOT0 pin or user option must be kept in the required Boot mode configuration in standby modes. 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 AN2606 “ STM32 microcontroller system memory boot mode ”.

Embedded root security services (RSS) (a)

The embedded RSS are located in the secure information block, programmed by ST during production. Refer to the AN4992 “ Introduction to secure firmware install (SFI) for STM32 MCUs ”.


a. STM32WBA52/4/5xx devices only.