Hello
OK I get it.
For PowerPC you have to do as follows:
- Define your variable in a user defined section.
This is done as follows:
#pragma section data_type ".myIData" ".myUData" data_mode=far_abs code_mode=pc_rel
__declspec(section ".myIData")int MyVar[100];
- Place .myIData and .myUData accordingly in your linker file.
Variable will be placed in .myIData if it is defined with an initializer. It will be placed in .myUData if it is defined without initialization value.
GROUP : {
.data : {}
.myIData: {}
.sdata : {}
.sbss : {}
.sdata2 : {}
.sbss2 : {}
.bss : {}
_myDataStart=.;
.myUData: {}
_myDataEnd=.;
.PPC.EMB.sdata0 : {}
.PPC.EMB.sbss0 : {}
} > ram
Label _myDataStart will be defined by the linker and will point to start address of the section myUData.
- Do a local copy of the module __start.c (located in {Install}\PowerPC_EABI_Support\Runtime\Src
- Update your __start.c module as follows:
Add an external declaration for the symbol _myDataStart:
extern char _myDataStart[];
In the function __init_data skip the block if address is equal to _myDataStart.
For uninitialized variable, modify the block starting with /*Initialized with zeros */ as follows:
bii = _bss_init_info;
while (1) {
if (bii->addr == 0 && bii->size == 0) break;
if (bii->addr == _myDataStart) break;
__init_bss_section(bii->addr, bii->size);
bii++;
}
For uninitialized variable, modify the block starting with /*Copy ROM to RAM */ as follows:
dci = _rom_copy_info;
while (1) {
if (dci->rom == 0 && dci->addr == 0 && dci->size == 0) break;
if (dci->addr == _myDataStart) break;
__copy_rom_section(dci->addr, dci->rom, dci->size);
dci++;
}
This should do it.
CrasyCat