Keil Logo

C166: PLACING VARIABLES IN NON-VOLATILE RAM


Information in this article applies to:

  • C166 Version 4
  • C166 Version 5

QUESTION

I use off-chip non-volatile RAM on the C164 microcontroller to save calibration parameters. I need to keep those values safe in memory even in case of software modification.

How can I store a few variables at a fixed memory location? The location must remain at the same place even when I change my software, so that several software revisions use the same configuration data.

ANSWER

The C166 Compiler offers several directives that are required for this:

  • The NOINIT compiler directive prevents the clearing of the variables in the startup code.
  • The ORDER compiler directive ensures that the variables are stored in the order of their definition.
  • You may use the linker location directives to define fixed memory addresses for the variables that are defined in a C source module. In µVision, you may enter section names under Options - L166 Locate - User Sections.

An example that is almost identical to your requirement is in the Getting Started User's Guide, under Creating Applications, Tips and Tricks, Locate Sections to Absolute Memory Locations.

MORE INFORMATION

SEE ALSO

Last Reviewed: Friday, July 15, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

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.