|
|||||||||||
|
Technical Support Support Resources
Product Information |
C166: Using the MVAR Macro for Fixed Variable LocationInformation in this article applies to:
QUESTIONI have a question about locating variables at absolute memory addresses using the C166 compiler. With the C51 compiler, it was no problem to define a variable at an absolute memory address (int x _at_ 0x1234). I need to make sure that all my variables are at absolute memory addresses, because after a reset or even a program update, I need to access all values as they were when the machine was turned off. The C166 manual says either to use the linker controls to locate variables or to use the MVAR macro to access the memory. It seems that the MVAR macro would make it very "painful" to write a program (if you must use MVAR whenever you access a variable). Using the linker sounds better, but for a couple of hundred variables this may be too long for a link command. Any help will be appreciated. ANSWERThere is an easy way to use the MVAR macro for your application. In the following code, you can define variables using #define...
Then, when you use the defined variable name (x, y, or z in this case) the MVAR macro accesses the correct memory location. This should help and it only requires that you write "special" code for the variable "declaration" or definition as it is in this case. MORE INFORMATION
Last Reviewed: Thursday, February 25, 2021 | ||||||||||
|
|||||||||||
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.