AnsweredAssumed Answered

Incomprehensible linker error: failing to place constant at absolute address.

Question asked by kigo on Nov 5, 2009
Latest reply on Nov 6, 2009 by kigo

I want to place a constant at absolute address, but linker issue:

 

[Error li1173]  Failed to extract symbol '_Firmware_Crc' needed for absolute placement.
        Symbol is embedded in object (.epcrodata, .epcrodata.end).
.

My source file ver.c looks as:

 

    const unsigned short Firmware_Crc = 0xffff;

 

My .ldf file contains:

 

PROCESSOR p0
{
...

  RESOLVE(_Firmware_Crc,  CRC_ADDR)

  KEEP(_start, _main, ___inits, _Firmware_Crc)

  SECTIONS
  {
...

      ASYNC0_constdata
      {
        INPUT_SECTION_ALIGN(4)
        INPUT_SECTIONS($OBJECTS{requiredForROMBoot}(constdata) $LIBRARIES{requiredForROMBoot}(constdata))
        INPUT_SECTIONS($OBJECTS(constdata) $LIBRARIES(constdata))

        INPUT_SECTION_ALIGN(2)
        INPUT_SECTIONS_PIN_EXCLUSIVE(ver.doj(constdata))

      } > MEM_ASYNC0
...

CRC_ADDR is equal to 0x2000FFFE (last two bytes of 64Kb, because my firmware has size less then 64Kb)

 

 

What do I wrong? And what a misterious object .epcrodata?

 

P.S. I examined assembler file ver.s produced by compilator. This is a piece of it:

 

     .section/DOUBLE32 constdata;

      .align 4;
     .epcrodata:
      .type .epcrodata,STT_OBJECT;
     _Firmware_Crc:
      .global _Firmware_Crc;
      .type _Firmware_Crc,STT_OBJECT;
      .byte =
       0xFF,0xFF;
     .epcrodata.end:


So my constant is placed inside of  .epcrodata. But what I should do to fix this problem?

Outcomes