1
NXPTM LPC2XXX and LPC17XX / How to put a struct at a defined address in FLASH
« on: May 12, 2011, 11:42:18 AM »
Hi All,
I am using the Crossworks project with an LPC2468, which is ok so far.
Now I want to put a structure of 0x20 bytes exactly at 0x7DFE0 in FLASH.
The project makes use of a linker script instead of Rowley`s section placement file.
My question is "How can I place the file at this address using a linker script?"
This is what I did up to now:
Modification of the script file uTaskerLPC23XX.ld
1. FLASH has been reduced and a memory segment has been added
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x0007C000
/* ... */
STRUANLAGE (rx) :ORIGIN = 0x0007DFE0, LENGTH = 0x20
/* ... */
}
2. The section .struanl has been added
SECTIONS
{
/* ..... */
__struanl_start__ = 0x7DFE0;
.struanl __struanl_start__ (NOLOAD) :
{
*(.struanl .struanl.* .glue_7t .glue_7 .gnu.linkonce.t.*)
}
. = ASSERT(__struanl_start__ >= 0x7DFE0 && (__struanl_start__ + SIZEOF(.struanl)) <= 0x7E000 , "error: .struanl is too large to fit in STRURANLAGE memory segment");
/* .... */
}
Linking is done without errors.
The structure I would like to locate at 0x7DFE is in StrukturAnlage.c:
const STRUANLAGE Anlage = {
...
}
In the Project Manager at Section Options I changed the Constant Section Name from .rodata to .struanl.
This should be ok. as I have done that before in a project that used a section placement file.
But I suppose that this modification is useless because a linker script is used.
When I load the progamme into the debugger (Crossworks), Anlage is at address 0, not at 0x7DFE0.
I then added an attribute to the structure
const STRUANLAGE Anlage __attribute__ ((section(".struanl"))) = {
...
}
but the result is the same, i.e. Anlage is located at address 0.
Can anybody tell me what is wrong?
Henry
I am using the Crossworks project with an LPC2468, which is ok so far.
Now I want to put a structure of 0x20 bytes exactly at 0x7DFE0 in FLASH.
The project makes use of a linker script instead of Rowley`s section placement file.
My question is "How can I place the file at this address using a linker script?"
This is what I did up to now:
Modification of the script file uTaskerLPC23XX.ld
1. FLASH has been reduced and a memory segment has been added
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x0007C000
/* ... */
STRUANLAGE (rx) :ORIGIN = 0x0007DFE0, LENGTH = 0x20
/* ... */
}
2. The section .struanl has been added
SECTIONS
{
/* ..... */
__struanl_start__ = 0x7DFE0;
.struanl __struanl_start__ (NOLOAD) :
{
*(.struanl .struanl.* .glue_7t .glue_7 .gnu.linkonce.t.*)
}
. = ASSERT(__struanl_start__ >= 0x7DFE0 && (__struanl_start__ + SIZEOF(.struanl)) <= 0x7E000 , "error: .struanl is too large to fit in STRURANLAGE memory segment");
/* .... */
}
Linking is done without errors.
The structure I would like to locate at 0x7DFE is in StrukturAnlage.c:
const STRUANLAGE Anlage = {
...
}
In the Project Manager at Section Options I changed the Constant Section Name from .rodata to .struanl.
This should be ok. as I have done that before in a project that used a section placement file.
But I suppose that this modification is useless because a linker script is used.
When I load the progamme into the debugger (Crossworks), Anlage is at address 0, not at 0x7DFE0.
I then added an attribute to the structure
const STRUANLAGE Anlage __attribute__ ((section(".struanl"))) = {
...
}
but the result is the same, i.e. Anlage is located at address 0.
Can anybody tell me what is wrong?
Henry