Keil Logo

C51: STACK UTILIZATION


Information in this article applies to:

  • C51 All Versions

QUESTION

How does the C51 compiler utilize the stack?

ANSWER

The 8051 hardware stack is used for:

  • Return addresses from function calls,
  • Saving and restoring registers used in interrupts,and
  • Saving and restoring intermediate results.

While the 8051 architecture restricts the stack to internal memory, it may be located at any point therein. The stack typically starts following the last individual variable allocation in internal memory and is free to grow *up* through whatever memory remains. C51 stack usage is minimal.

Automatic, local variables are overlaid in internal data memory using a strategy that maximizes memory utilization. This is similar to the method used by the Intel PL/M-51 programming language.

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Friday, January 30, 2015


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

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.