Keil™, An ARM® Company

Technical Support

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: Sunday, May 16, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure