Linker section .data from *.elf file is not loaded

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Linker section .data from *.elf file is not loaded

1,360 次查看
m_botthof
Contributor I

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?

标签 (1)
0 项奖励
回复
2 回复数

1,203 次查看
yipingwang
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,203 次查看
m_botthof
Contributor I

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)?

0 项奖励
回复