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: Load error in MIPS Malta board




> -----Original Message-----
> From: S Sathyanarayanan [mailto:sathyas@sankhya.com]
> Sent: Wednesday, May 08, 2002 11:42 AM
> To: crossgcc@sources.redhat.com
> Subject: Load error in MIPS Malta board
> 
> 
> Hi,
> 
>  I have successfully compiled my application with mips-g++ 
> compiler build
>  with newlib.but i'm not able to load it in MIPS Malta board
> using YAMON monitor. Iam trying to load S-Record file generated using 
> mips-objcopy. The SDRAM available memory is 64mb. My file size is just
> 600kb. Here is my linker script,

What error messages do you get?

You can try objdump to see if all your code/data/bss is in the proper
address range.
You may also let ld generate a map file (ld -Map mapfile) to see if
something is out of the address range of your target.

> 
> OUTPUT_ARCH(mips)
> 
> /**** Start point ****/
> OUTPUT_FORMAT("elf32-bigmips")
> ENTRY(_start)                   /* Entry point of application 
>           */
> SEARCH_DIR(/mnt/engr224/sankhya/gnu/release/sathyas/cross/mips
> /lib/gcc-lib/mips-
> elf/2.95);
> GROUP(-lstdc++ -lgcc -lidt -lc)
> SECTIONS
> {
>   /**** Code and read-only data ****/
> 
>   .text 0x80094550 :
>   {
>     _ftext = ABSOLUTE(.) ;      /* Start of code and 
> read-only data     */
>     start.o (.text)             /* Entry point                
>           */
>     *(.text)
>     _ecode = ABSOLUTE(.) ;      /* End of code                
>           */
> 
>     *(.rodata)
> 
>     . = ALIGN(8);
>     _etext = ABSOLUTE(.);       /* End of code and read-only 
> data       */
>   } = 0
> 
>   /**** Initialised data ****/
> 
>   .data :
>   {
>     _fdata = ABSOLUTE(.);       /* Start of initialised data  
>           */
>     *(.data)
> 
>     . = ALIGN(8);
> 
>     _gp = ABSOLUTE(.); /* Base of small data                    */
> 
>     *(.lit8)
>     *(.lit4)
>     *(.sdata)
> 
>     . = ALIGN(8);
> 
>     _edata  = ABSOLUTE(.);      /* End of initialised data    
>           */
>   }

The above looks suspicious to me. If I read the docs correctly, this
means your data segment begins at address 0, but maybe it starts after
the .text section?
The same applis to the other sections below.

My approach to this problem is to define the target memory layout with a
MEMORY statement and put all sections into that memory in the desired
order (with the ">" operator).

You may take the examples from the "Using LD" doc as a starting point.

Wolfgang

>   /**** Uninitialised data ****/
> 
>   _fbss = .;                    /* Start of uninitialised 
> data          */
> 
>   .sbss :
>   {
>     *(.sbss)
>     *(.scommon)
>   }
>   .bss :
>   {
>     *(.bss)
>     *(COMMON)
> 
>     /* Allocate room for stack */
>     .   =  ALIGN(8) ;
>     .   += 0x5000 ;
>     _sp =  . - 16;
>   }
> 
>   _end = . ;                    /* End of unitialised data    
>           */
> 
>   .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
>  .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
> 
>   /DISCARD/ :
>   {
>     *(.reginfo)
>   }
> 
>   PROVIDE(etext = _etext);
>   PROVIDE (edata = .);
>   PROVIDE (end = .);
> }
> 
> I am linking three object files along with the above libraries. one of
> them is start.o 
> 
> Please help if you know what is going wrong. 
> 
> BTW, I have checked the memory, it is free for user application from
> SDRAM size =                  64 MByte
> First free SDRAM address =    0x80094540
> 
> Thanks,
> sathya
> 
> 
> 
> ------
> Want more information?  See the CrossGCC FAQ, 
> http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to 
> crossgcc-unsubscribe@sources.redhat.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]