VTOR and initial stack for debuggers #283
Description
In crt0.s
you'll usually find statements like the next one at the very beginning of the code:
ldr SP, =_stack_start
To set the initial stack pointer to the correct value. You'll find it along with code to set VTOR
, and other tasks considered as protective programming. This allows to mimic the HW reset behavior to start off in the same environment when the software is launched from a debugger (ie. lauterbach)
Can this be implemented in fn Reset() -> !
?
One can argue that this can be implemented inside the preinit function, but in the stack pointer case it wont work as the stack has already been used by that moment and on function epilogue it will be incremented causing an incorrect mem access. Setting it using the debugger is also possible, but is not very clean to have this values (IVT location or stack start) in the debugger context.