I try to load a *.elf file into my target device (evaluation board "T42D4RDB" for QorIQ T1042). After the elf file is loaded, I find that the .data section has not been loaded into the RAM. The .text section has been loaded correctly.
My CRT0 function works so that it copies the .data section from behind the .text section to its correct position. Therefore, the .data section must be loaded from codewarrior when loading the elf file. Do you have a hint how to load the .data section by codewarrior?
Hello M. Botthof,
You could refer to the example in the file <project>_gcc-aeabi_ROM.lcf in CodeWarrior default project.
PROVIDE (__etext = .);
.sdata :
AT (_etext)
{
__SDATA_START__ = .;
_sdata = . ;
_SDA_BASE_ = . + 32768 ; *(.sdata .sdata.* .gnu.linkonce.s.*)
_fsdata = .;
__SDATA_END__ = .;
} > ram
_esdata = _etext + SIZEOF (.sdata);
.data :
AT ((_etext)+SIZEOF(.sdata))
{
_data = . ;
*(.data .data.* .gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
} > ram
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi,
thanks for your reply. My linker file includes a .data section like yours. My problem is, that CodeWarrior loads this .data section to the linked address ("ram" address) and not to the address directly behind the .text section (from which my ctr0 will copy the .data section to the linked address).
This means, after CodeWarrior loaded the elf file, the data in RAM is correct, but when my crt0 code is executed (like it will be, when starting out of flash), it will overwrite the data in RAM.
Is there a possibility to get CodeWarrior to load the .data section right behind the .text section (the AT(...) address of .data section)?