Technical Support

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