cancel
Showing results for 
Search instead for 
Did you mean: 

What is the value present at the first address of flash memory of stm32 for every firmware?

rohitsam
Associate

Every firmware of Stm32 microcontrollers, the first value is starting with 0x2XXXXXXX, while working with custom bootloaders, I found that this is an address on SRAM,

0693W000003Pvk3QAC.png

Every firmware of Stm32 microcontrollers, the first value is starting with 0x2XXXXXXX, while working with custom bootloaders, I found that this is an address on SRAM,

1)What is actually present at this address of SRAM?

2)In custom bootloaders What is the significance of setting the MSP to this address on SRAM, before calling the reset handler of the user-application?

uint32_t msp_value = *((volatile uint32_t *)FLASH_SECTOR2_BASE_ADDRESS);
__set_MSP(msp_value);
app_reset_handler();

2 REPLIES 2

It is the Initial Stack Pointer, loaded by the processor.

Might want to review a Technical Reference Manual for the Cortex-M series or book by Joseph Yiu.

Still not making sense perhaps a book on Computer or Microcontroller Architecture/Design.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
prain
Senior III

1)What is actually present at this address of SRAM?

it is the address of stack pointer at startup. Also next locations are the address of the specific MCU vectors (known as vector table).

2)In custom bootloaders What is the significance of setting the MSP to this address on SRAM, before calling the reset handler of the user-application?

Cortex core needs to know about first stack location at reset. So you can set the stack location using __set_MSP() .