ARM Technical Support Knowledge Articles

LOCATE VARIABLES TO ABSOLUTE ADDRESSES

Applies to: C166 C Compiler

Answer


Information in this article applies to:


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

ATTACHED FILES

Request the files attached to this knowledgebase article.

Article last edited on: 2007-06-26 11:30:36

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential