Question

I have a question about how to specify the start address of code using gcc tools. I ussualy use the linker script to specify the start address of my code:

SECTIONS
{
   .  =  0x10000;
   .text  :  {  *(.text)  }
   .  =  0x8000000;
   .data  :  {  *(.data)  }
   .bss  :  {  *(.bss)  }
}

while analyzing the TI X-Loader (for beagleboard), I saw that in the x-load.lds the start address is put to 0x00000000. The correct start address is specified by "-Ttext 0x40200800" (RAM) in the config.mk file as a LD option.

My question: why use the -Ttext in the config.mk (LDFLAGS) instead of specifying it in the linker script?

Thanks in advance for your help.

Regards, Martin

Was it helpful?

Solution

Well, essentially because of same reason as avoiding any hardcoded values — it's more easy to parametrize.

Additionally, you don't have to dig in the linker script, so it's easier for newcomers.

If you're looking for some "principal" reason — there is not one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top