I am kind of confused about using the _at_ keyword to assign a specific address to a variable.
so for example :
extern xdata char variable _at_ 0x000f;
it fills 3 bytes in xram . can any one explain how is the compiler handling these sequence. Thank you !
Actually, putting the _at_ in the extern usually is a mistake - because the extern usually should be just a declaration and not the definition
Before WW3 erupts again, I decided to see what it gives with the ARM's RealView compiler.
Inserting this declaration,
extern int variable __attribute__((__at(0x8000))) ;
Generated this warning:
main.c(315): warning: #1207-D: attribute "__at" ignored
(variable is defined somewhere else). So, Jack, this is so much according to the standard, how come the compiler generates a warning?
The extern keyword is part of the standard.
The __at keyword is not.
So when you combine the two, the combination will not be part of the standard. In this, I agree with Erik. People should not push their luck too much.
Another important thing is that embedded compilers (besides regularly adding non-standard features to better map to the processor and embedded use) are notorious for being less standards-compliant than "PC compilers". This comes for the much smaller customer base. Less people to catch bugs and design oops. But also often less resources to maintain the compiler.
M$ has a way larger budget to keep their compilers updated. And their track record still shows how hard they have had with standards compliance.
i found my mistake, it is as you've just said, i used the _at_ in a extern declaration. I'm a newbie and i have alot to learn. Thank you all !!