ARM Technical Support Knowledge Articles

RUNTIME DETERMINATION OF LAST XDATA ADDRESS USED

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

Is there a way to determine, at runtime, the last used location in xdata? I want to use the remaining xdata space (beyond the last xdata variable allocated) as a small heap.

ANSWER

One way to do this is to create a file containing only an xdata variable declaration. For example:

xdata unsigned char last_var_used;

When you create your project, make sure that this is the last file in the project file list. When the project is linked, this file will be linked last AND the last_var_used variable will be located at the end of xdata memory.

You may use the C address-of operator ('&') to get the address of this variable.

SEE ALSO

Article last edited on: 2002-02-18 00:00:00

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