This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Changing default memory segments
- To: Dainis Strupis <Dainis at fortech dot lv>
- Subject: Re: Changing default memory segments
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- Date: 07 Aug 2001 15:44:15 +0100
- Cc: "'binutils at sources dot redhat dot com'" <binutils at sources dot redhat dot com>
- References: <620C734D5719D5118ED500306E018727078A29@walker.fortech.lv>
Hi Dainis,
> What is right syntax for "ld" script for putting code (.text)
> segment from several files to other memory region (SRAM but not
> DRAM) without change segment name ?
The way to do this is to use memory regions. For example a script
like this:
MEMORY
{
SRAM (rx) : ORIGIN = 0x123456, LENGTH = 48K
DRAM (wx) : ORIGIN = 0x778899, LENGTH = 4M
}
SECTIONS
{
.text.sram :
{
sram/*.o(.text) ;
} > SRAM
.text.dram :
{
*.o(.text) ;
} > DRAM
}
declares two memory areas, one called SRAM and one called DRAM.
(These names are arbitary). Then it creates a section called
.text.sram which will be placed in the SRAM memory region and which
will contain all of the .text sections from object files found in the
sram/ object directory. It also creates another section called
.text.dram which contains all the remaining .text sections in the
object files mentioned on the command line used to invoke the linker.
Cheers
Nick