In terms of microcontrollers and embedded systems with C startup code, one of the functions of the C startup code is to initialize the stack pointer.
Is this initial stack pointer address and C startup code generally defined and provided by the chip vendor?
Or is it up to us as the firmware / software developers to manually modify or create the C startup code and specify the stack pointer? This part confuses me.
Every architecture does it it's way. ARM Cortex uCs have the initial stack pointer location stored as the first 32 bits value in the vector table. This value is loaded by the hardware when the uC is booted. So this address is fully controllable by the programmer.
Then the start-up routine can change it or set the double stack (one for the thread another for the privileged mode).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With