What is the reason Cortex-M3 has the initial stack pointer value located at 0x0, and reset handler located at 0x4? What is the design justification for this?
Why couldn't the ARM guys leave 0x0 to the reset handler like they do for Cortex-A, then initialize SP inside the reset handler?
everything unixsmurf said...
The traditional arm approach was a little strange, the typical approach is a list of addresses, not a table of instructions. So that may have been a factor. But they created a gobzillion interrupts not just the one (the vector table is 128/256 deep not just a handful) and no doubt you dont want to have to wrap every interrupt before calling C so the vector table, the changes in/lack of modes, and preserving registers for you, puts this package all together. You can put the address of the C handler right in the table, including the reset vector, to get the reset vector in there you need to have at a bare minimum set the stack pointer before calling, thus you need a spot for the user to indicate the initial value for the stack pointer.