Hey Michel,
Michel wrote:
> I am using the KEIL IDE for ARM7 processors with the GNU Cygnus
> compiler on a LPC2106 target. My problem is that I cannot find
> in the documentation how to tell the compiler to locate an object
> at a specified place (somwhere in flash memory, for instance).
> at 0x00016000 int base;
TomW replied with:
> That would be the linker that would do the physical location of things.
>
> Compilers build relocatable objects, linkers place those into regions
> that you specify in the linker file (script).
Could you please tell us WHY you want to do this?
The only time I can ever think of needed to force a particular
code at a specific address is;
a) an exception vector(s)
b) an overlay for a set of device control registers
For (a) you can define a section, and use the linker script to
perform the locating in Flash. For (b), I've always found it
nicer to just use a pointer to the peripherals region instead,
eg.
typedef struct serial {
int control;
int status;
int data;
} serial_t;
serial_t *com1 = (serial_t *)(SERIAL_BASE_ADDR);
registers are accessed as com1->control = ...
If you use the linker to link this structure over a specific range
of addresses, then the syntax changes to com1.control = ...
But you have to do more work with the linker script.
So, perhaps you are trying to implement something the
difficult way, tell us what you are trying to do.
Cheers,
DaveMessage
RE: [lpc2000] How to specify the location of an object in memory(GNU)
2005-11-01 by David Hawkins
Attachments
- No local attachments were found for this message.