Starting with the first address 0x0000 0000 it stores the value of initial value of MSP (the main stack pointer) and the second address 0x0000 0004 stores the value for the PC.

<aside> 💡

The LR register is set to 0xFFFF FFFF

</aside>

image.png

And the first routine be run is the Reset_Handler , this mean that the PC register is set to the address of this routine that rests the mcu (rest register the bss, calls the SystemInit routine and CopyDataInit routine.) then call main function

note:

image.png

image.png

In the arm architecture the LSB indicats if the the cpu is running the thump mode or arm mode LSB = 1: thump mode

<aside> 💡

arm cortex-m only supports the thump mode

</aside>

image.png

boot pin

STM32 Boot Modes

microcontrollers support multiple boot modes that determine how the device initializes and where it fetches the initial code to execute. In this section, we’ll discuss the primary boot modes for STM32 microcontrollers.

STM32 Boot Mode Options

1) Main Flash Memory Boot:

The microcontroller boots from the main flash memory, where the user application is stored. This is the most common boot mode used in production devices.

2) System Memory Boot:

The microcontroller boots from the system memory, which contains the built-in bootloader. This mode is often used for firmware updates or initial programming through various interfaces such as UART, USB, or SPI.

3) Embedded SRAM Boot:

The microcontroller boots from the internal SRAM, which is mainly used for debugging or special purposes.

image.png

It’s very easy to identify the Boot0 pin in an STM32 microcontroller as you can see in the figure below. This is a special function pin for the microcontroller and is not multiplexed with any GPIO functionality.