ARM Technical Support Knowledge Articles

LOCATE CONSTANTS TO ABSOLUTE ADDRESSES

Applies to: C166 C Compiler

Answer


Information in this article applies to:


QUESTION

I need to locate a memory range table to a specific memory address. In addition, I need at the beginning of this memory area a pointer to the address table and a specify long value.

All this information must reside in Flash ROM on a fixed memory address (0x200 in my case). How can I do this?

ANSWER

The following example locate certain variables in the order you specify in the source file. We have called this file INIT.C and this module contains only the declaration for this variables.

#pragma ORDER     // keep variables in order

struct range  {
  unsigned long start;
  unsigned long stop;
};

extern const struct range   huge ranges[];

const struct range  huge * const huge rstart  = ranges;
const unsigned long         huge someval = 0x12345678;

const struct range          huge ranges[] =
{
  { 0,      0x25F  },
  { 0x260,  0x5000 },
  { 0,      0      },
};

The C166 Compiler generates an object file for INIT.C and includes a section for all the variables in the huge const memory area.

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

?HC?INIT%HCONST (0x200)

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:39:14

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