Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Having defines in linker script for memory origin and length

MEMORY
{
    RAM (rxai!w) :                  ORIGIN = 0x80000000 LENGTH = 34K
}

Lets say I have a section in linker script like above. can i have a define for 0x80000000 and 34K. I want it to look like,

MEMORY
{
    RAM (rxai!w) :                  ORIGIN = RAM_ORIGIN LENGTH = RAM_LENGTH
}

So my question how to put this define in linker script? I have a script that auto generates the linker script and the defines will be different every time.

like image 477
Thomas Avatar asked Oct 17 '25 09:10

Thomas


1 Answers

I figured that having the defines a different file like common.ld in the following format,

RAM_ORIGIN = 0x80000000;
RAM_LENGTH = 34K;

works. But this common.ld could not be included directly in the linker script using 'INCLUDE'. If i pass it in the command line as -Wl,common.ld then it works.

like image 90
Thomas Avatar answered Oct 21 '25 01:10

Thomas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!