ld linker script and non-contiguous memory region

Taortan Development taortan_dev@yahoo.se
Mon Jan 16 14:53:00 GMT 2012


Hi all,

How can I write a linker script to tell the linker to place sections around a "hole" in my memory region?
Is it possible?

For example:
I define a memory region
MEMORY 
{
/* 0x0 -> 0x4000 */
FLASH (rx) : ORIGIN = 0x0, LENGTH = 16K
}

Now I define an output section for my code
SECTIONS 
{
.text :
{
*(.text*)
} > FLASH
}

Now I want to make sure that the linker never places 
anything inside of the area 0x2000 -> 0x3000. How could I express that?

I could for example define the memory as two regions (starting at 0x0 length 8K and 0x3000 length 4K) instead,
but then I would have to manually place code from different object files/sections into the two regions to fill it optimally (?).

Is there a way to make the linker take care of this for me?



NOTE: the above linker script is simplified for demonstration purposes

Best regards



More information about the Binutils mailing list