This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
ld linker script and non-contiguous memory region
- From: Taortan Development <taortan_dev at yahoo dot se>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Mon, 16 Jan 2012 14:53:20 +0000 (GMT)
- Subject: ld linker script and non-contiguous memory region
- References: <1326725162.97799.YahooMailNeo@web132404.mail.ird.yahoo.com>
- Reply-to: Taortan Development <taortan_dev at yahoo dot se>
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