This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Changing default memory segments


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]