|
|||||||||||
Technical Support Support Resources
Product Information |
C51: Stack Pointer Initialization in Startup CodeInformation in this article applies to:
SYMPTOMSThe stack pointer is initialized at the end of the C startup code in STARTUP.A51. Why is this necessary? CAUSEThe last few lines of the startup code appear as follows:
After reset, the stack pointer is initialized to 7h. The stack will start growing up from address 8h. The Keil C compiler uses internal DATA memory for your variables and also allows you to use register banks 1, 2, and 3. If the stack pointer were not adjusted, calls to functions and interrupts would overwrite your variables. Therefore, the last thing the startup code does is to set the stack pointer to the end of all your internal DATA variables. SEE ALSO
Last Reviewed: Thursday, February 25, 2021 | ||||||||||
|
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.