This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Beginner question: stack pointer initialization

Hi,

I'm pretty new to ARM processor and STM32 microcontroller, so my question is very basic.

In the startup file for a SW4STM32 project (eg startup_stm32f446xx.s) the stack pointer is set in Reset_Handler with the line

ldr  sp, =_estack     /* set stack pointer */

 

why is this needed? I mean as far as I know the ARM Cortex-M is fetching automatically the value of the stack pointer as first step during the booting sequence. Why has it to be done a second time via software? I looks like it is initialized twice to the same value (_estack) since the vector table has the form:

 

.word _estack

.word Reset_Handler

.

.

.

Parents Reply Children
No data