Hello,
I'd like to assign the variable to a speicified RAM location, for example, there is a variable Var which I'd like to assign to the address 0xB000, is there any way it can be achieved?
In the help document, I only find something like user-defined section, but it seems that it can only be used for a C file, but I'd like to used something inside a C file and only affect one variable? I am using C166 compiler.
Thank, Simon
Why don't you start your post with something completely different - why not start by telling _why_ you want to have the variable at an absolute location. The _why_ is often more important than the _what_ when asking for help.
www.catb.org/.../smart-questions.html
Hello Per,
In my appliation, there are some variables that we call them safety critical variables, the others are non saftey critical variables. I want to put all the safety critical variables in a absolute location, but those variables are defined in the different C source file. I once used Freecale Codewarrior, there are something like "#pragma section" which can help me do it. But I don't find the similar thing in Keil C166. So that's why I post this message.
Thanks, Simon
You're still describing the step - not the goal.
Why do you want to place these variables at an a absolute location?
What do you think you will gain by that?
What will that achieve?
If you have critical variables that should survive a reboot, then a simple method is to modify your project and reduce the size of RAM.
Then you can define a struct with all the variables that should survive a reset. Set such a struct pointer to this memory area and access the relevant fields, after having checked a CRC of the struct to figure out if the content is valid.
... under Absolute Memory Access:
http://www.keil.com/support/man/docs/c166/c166_ap_linkerloc.htm