ARM Technical Support Knowledge Articles

REENTRANT FUNCTIONS AND VARIABLES

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

In the SMALL memory model (all RAM internal, all code in 8K), do reentrant functions use the push and pop instructions to put variables on the stack or do they overlay variables?

ANSWER

The reentrant stack is simulated using R0 and R1. Variables are "pushed" and "popped" using the MOV @R0/R1 instructions. The hardware stack is not used for these variables.

When you use the reentrant stack in internal memory, the hardware stack (accessed with SP) starts at the bottom of memory and grows up. The simulated reentrant stack starts at the top of memory (255) and grows down.

You may use a debugger watch and test for the collision of these two stacks.

SEE ALSO

Article last edited on: 2004-06-15 13:52:51

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential