ARM Technical Support Knowledge Articles

CREATING A FIXED STACK SEGMENT

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

Is it possible to define a fixed stack location for the 8051's hardware stack?

ANSWER

Yes. The easiest way to do this is to modify the STARTUP code so the stack is an absolute segment at a fixed location. For example:

In the STARTUP code, change the following:

?STACK          SEGMENT   IDATA
                RSEG    ?STACK
                DS      100h-080h

to:

ISEG    AT      0xA0
?STACK: DS      0x100 - ?STACK

This creates an absolute segment for the stack. Then, you can change the 0xA0 to the address where you want the stack to reside. This has the advantage that if your C program variables overlap with the stack, the linker emits a warning.

SEE ALSO

Article last edited on: 2004-05-01 10:40:29

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