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:
Defensive programming :-) Seriously: If you use a debugger and place the PC at your reset entry, SP might point somewhere.