Hello
I assume you are using CodeWarrior for ColdFire V6.2.
In order to place a variable at a specific address you can
1- Allocate it in a user defined section and allocate the section appropriately in
the .lcf file.
2- Use the OBJECT linker command
To allocate an object in a user defined section use following notation:
#pragma define_section myData ".myData" far_absolute RW
__declspec(myData) int MyVar;
To make sure the section myData is allocated first in RAM area, modify your ,lcf file as follows:
.uninitialized_data :
{
*(.myData)
__START_SBSS = .;
*(.sbss)
. = ALIGN(0x8);
*(SCOMMON)
__END_SBSS = .;
__START_BSS = .;
main.c(.bss)
*(.bss)
. = ALIGN(0x8);
*(COMMON)
__END_BSS = .;
. = ALIGN(0x8);
} > DATA
2- is implemented as follows:
Suppose you have following variable defined in main.c source file:
int myVar2;
You can use the object keyword as follows in the .lcf file:
.uninitialized_data :
{
OBJECT(_myVar2, main.c)
__START_SBSS = .;
*(.sbss)
. = ALIGN(0x8);
*(SCOMMON)
__END_SBSS = .;
__START_BSS = .;
main.c(.bss)
*(.bss)
. = ALIGN(0x8);
*(COMMON)
__END_BSS = .;
. = ALIGN(0x8);
} > DATA
Note that the compiler adds a leading _ as prefix to symbol names. In the .lcf file you have to refer to the object internal name.
The Targeting_ColdFire.pdf manual is the manual where you will find all info around the linker.
I hope this helps.
CrasyCat