|ARM Technical Support Knowledge Articles|
Applies to: C251 C Compiler
Information in this article applies to:
I declared two global variables in file main.c as follows:
unsigned char near x _at_ 0x2000 = 5; unsigned char near y _at_ 0x3000 = 10;
In the file main.h, I wrote:
extern unsigned char near x; extern unsigned char near y _at_ 0x3000;
main.h is included in main.c. On the map file generated, both x and y are not located at the desired locations. Why?
This only happens when you initialize a variable located with the _at_ keyword when declaring the variable and the extern is in the same scope as the declaration.
The solution is to arrange your project so that you do not have externs and declarations for the same variables in the same scope.
The best way to do this is:
Article last edited on: 2005-07-15 12:54:01
Did you find this article helpful? Yes No
How can we improve this article?