I'm trying to track down a problem on a MKV31F256 micro. The firmware immediately jumps to the hard fault handler on startup.
I'm able to set a breakpoint on the first assembly instruction in the reset handler and look at memory and the registers, and I was surprised to find the stack pointer was not set to the top of RAM (0x20008000). Rather, SP is set to 0x00000000
However, the initial stack value is correct in the vector table.
I was under the impression the Cortex M4 automatically loaded the first and second entry in the vector table into the SP and PC registers. Is this not the case?
I double checked on a different Cortex M4 micro (nRF52832) and SP is set correctly by the hardware on startup.
Is the automatic SP initialization an optional feature by the individual chip manufacturers?