ARM Technical Support Knowledge Articles

PLACING FAR VARIABLES AT ABSOLUTE LOCATIONS

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

How can I locate far variables at absolute memory locations. I have tried the following:

unsigned char far x _at_ 0x00000A;

But this generates the following compiler error message:

Error C274: Absolute Specifier Illegal

ANSWER

Variables of type far may be placed at absolute memory locations using the FVAR, FCVAR, FARRAY, and FCARRAY macros. For example:

#define IOVAL FVAR (long, 0x14FFE)   // long at HDATA address 0x14FFE
.
.
.
int var;
.
.
.
var = IOVAL;                 /* read */
IOVAL = 0x10;                /* write */
var = FCVAR (int, 0x24002)   /* read int from HCONST address 0x24002 */
.
.
.

STATUS

Support for _at_ and far addresses was added in C51 Version 7.

MORE INFORMATION

SEE ALSO

Article last edited on: 2007-04-10 11:58:22

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