This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler: TI linker spc assignment problem

Tool/software: TI C/C++ Compiler

Hello,

I am trying to do the following using the TI linker:

.sec1 :

{
__sec1Start = .;

*(.sec1_in)
*(.sec1_in.*)

. = __sec1Start + 0x2000;

*(.sec2_in)

*(.sec2_in.*)

. = __sec1Start+ 0x4000 - 1;


__sec1End= .;


} > MEM

This results in an error : 

symbol "__sec1Start " used in expression before it has been assigned a value

The EXACT same thing works just fine with a GNU linker.

What is wrong - shouldn't this be a standard linker syntax? how can i circumvent this problem/bug to accomplish the same on the TI linker?

Thanks

Guy

  • Hello,
    For my case I was able to find a workaround using the fact the inside a section SPC always starts from 0 so instead of symbols i assigned it with absolute values relative to zero.
    Regardless, it still feels like this is a problem with the linker that it does not allow using symbols for SPC update.

    Will appreciate to hear other ways to resolve it / reasons for why it is not supported.

    Guy
  • Expressions assigned to "." must be constant at build time.  That is not the case with ...

    Guy Mardiks said:
    . = __sec1Start + 0x2000;

    Because at the time the value of this expression is computed, the symbol __sec1Start is still not defined.

    Guy Mardiks said:
    shouldn't this be a standard linker syntax?

    The TI linker command file syntax and the GCC linker script syntax evolved separately, with no knowledge of each other.

    Thanks and regards,

    -George

  • Hi, thank you.
    Is there some option to set the address of an output section based on another section's address or the same - setting the load address based on the run address?
    in GNU the ADDR(section) can be used to get the absolute run (VMA) address and use it to set the load (LMA) address
    (section : AT > ADDR(section)+0x100)

    Is there a way to accomplish the same with TI's linker?

    Thank
    Guys
  • Guy Mardiks said:
    Is there some option to set the address of an output section based on another section's address or the same - setting the load address based on the run address?

    There is no general builtin way to do it like GCC.  You might be able to hack a solution with #define constants and expressions.

    Thanks and regards,

    -George