2020-08-20 10:22 PM
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,
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();
2020-08-20 11:22 PM
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.
2020-09-02 01:07 AM
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() .