Skip to main content
Visitor II
August 21, 2020
Question

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

  • August 21, 2020
  • 2 replies
  • 1432 views

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();

    This topic has been closed for replies.

    2 replies

    Graduate II
    August 21, 2020

    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.​

    Visitor II
    September 2, 2020

    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() .