| |||||
Technical Support Support Resources
Product Information | C166: LOCATE CONSTANTS TO ABSOLUTE ADDRESSESInformation in this article applies to:
QUESTIONI 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? ANSWERThe 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
Last Reviewed: Tuesday, June 26, 2007 | ||||
| |||||