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

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linker script help needed - section not included in S3R file


You can specify the LMA ( address you are loading to
which is the ROM in your case) and the VMA( address
the linker will link to (RAM in your case)) for each
section, then in your start up code, do your copy from
ROM to RAM , by doing this you get your compact srec
ROM code and still link to sections in the RAM.

Mark  
--- Alan Cudmore <Alan.P.Cudmore.1@gsfc.nasa.gov>
wrote:
> I am trying to create a linker script to build an
> embedded program using 
> a mips toolchain ( gcc 2.95, ELF object format, big
> endian )
> 
> I want to have a small section of ROM code and data
> followed by the 
> normal code and data that gets copied from ROM to
> RAM.
> My problem is that the small section of ROM code and
> data are being left 
> out of the S-record file that I produce using
> objcopy ( also tried 
> producing the s-record directly from 'ld', no change
> ). Everything else 
> that I put in ROM is in the s-record file. Here are
> the parts of my 
> linker script and the output of objdump -x:
> 
> 
> /* ------------------------ Part of the linker 
> script ------------------- */
> ENTRY(_CpuInit)
> OUTPUT_ARCH("mips")
> OUTPUT_FORMAT("elf32-bigmips")
> __DYNAMIC  =  0;
> 
> 
> SECTIONS
> {
>    /*
>    **  This is the ROM startup code segment
>    **  located in EEPROM
>    */
>    .romtext 0xBFC40000 :
>    {
>      *(sec_bstart)
>    }
> 
>    .romdata : AT ( ADDR(.romtext) + SIZEOF
> (.romtext))
>    {
>      *(sec_dstart)
>    }
> 
>    /*
>    ** This is the RAM text segment
>    ** that is linked to ROM , but gets copied to RAM
>    */
>    .text 0x80020000 :  AT ( ADDR (.romdata) + SIZEOF
> (.romdata) )
>    {
>       _ftext = . ;
>      *(.text)
>      *(.text.*)
>      *(.gnu.linkonce.t*)
>      *(.mips16.fn.*)
>      *(.mips16.call.*)
> 
> /* ------------------------- end linker script
> fragment ---------------/
> 
> 
> /* ------------ Part of the objdump -x output
> -------------------- */
> 
> Sections:
> Idx Name          Size      VMA               LMA   
>            File 
> off  Algn
>    0 .romtext      000003e4  ffffffffbfc40000 
> ffffffffbfc40000  
> 00061a60  2**0
>                    CONTENTS
>    1 .romdata      00000144  ffffffffbfc403e4 
> ffffffffbfc403e4  
> 00061e44  2**2
>                    CONTENTS, READONLY
>    2 .text         0004adb4  ffffffff80020000 
> ffffffffbfc40528  
> 000000a0  2**4
>                    CONTENTS, ALLOC, LOAD, CODE
> 
> /* ----------------- end of the objdump -x output
> fragment -------- */
> 
> As you can see, the sections ( .romtext and .romdata
> ) have only the 
> CONTENTS attribute and are being left out of the
> s-record file. The 
> .text section has ALLOC and LOAD and is being
> included in the S-record 
> file.
> 
> Does anyone know what I'm doing wrong here? Are
> there section attributes 
> that I can set to allow these sections to be
> included in the S-record 
> file?
> 
> Thanks,
> 
> Alan
> 
> 
> ------
> Want more information?  See the CrossGCC FAQ,
> http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to
> crossgcc-unsubscribe@sources.redhat.com
> 


__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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