Keil Logo

C166: LOCATE VARIABLES TO ABSOLUTE ADDRESSES


Information in this article applies to:

  • C166 All Versions

QUESTION

My application requires that I locate a struct to an absolute memory address in an battery backup (non-volatile) RAM space. Is this possible.

ANSWER

The following example locates the struct alarm_control at address 0x128000. This structure is defined in a source file named ALMCTRL.C and this module contains only the declaration for this structure.

  :
  :
struct alarm_st {
unsigned int alarm_number;
unsigned char enable flag;
unsigned int time_delay;
unsigned char status;
};

#pragma NOINIT // disable zero initialization for alarm_control
struct alarm_st huge alarm_control;
  :
  :

The C166 Compiler generates an object file for ALMCTRL.C and includes a section for variables in the huge memory area. The variable alarm_control is the located in the section ?HD?ALMCTRL.

To locate this section enter under Options for Target – L166 Locate – Users Sections:

?HD?ALMCTRL%HDATA (0x128000)

The L166 SECTIONS directive requires that you enter both the section name and the memory class name.

MORE INFORMATION

SEE ALSO

Last Reviewed: Tuesday, June 26, 2007


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.