I'm using the uvision and I want to define a variable at a specific address.
I figured out that it should work like
int main(void) { int var __attribute__((__at(0x40001000))) = 20; }
but I always get the error message "expected an attribute name".
www.keil.com/.../armccref_ch04s05s02.htm
best regards Alan Scott
Hello Alan Scott,
note that at is without underlines.
int var __attribute__((at(0x40001000))) = 20;
You may also include absacc.h and use define __at
int var __at(0x40001000) = 20;
Best Regards, Martin Guenther
thanks for your answer. I included absacc.h and tried to use your solution.
Now I get the error message "the at attribute does not apply to local variables".
What keeps you from making the variable (file-) global ?
I'm not sure what you mean. I include absacc.h which which consists of the #define __at(addr) definition (if __at is not already defined).
Maybe you could show me a small example (how __at will work in uvision).
You can not use __at with a variable which is located on the stack. Use it with a global variable.
int var __at(0x40001000) = 20; int main(void) { // ... }
thanks for your answer. Now the short example works.