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]

RE: startup embedded target


Hello,

Try the following :

 SECTIONS {
   .vector0 :
    {
     LONG( __stack )
    } > rom1
   .vector1 :
    {
     LONG( ABSOLUTE( main ) ) /* or _main depending on the compiler */
    } > rom1
.....

Since these are the 2 first sections that go into rom1, the value for stack
will be int the 4 first bytes and the value for main will be int the 4 next
ones.

Giovanni Caterina


> -----Original Message-----
> From: Vermeulen Jan [mailto:Jan.Vermeulen@siemens.atea.be]
> Sent: vendredi 20 juillet 2001 09:48
> To: 'CrossGCC'
> Subject: startup embedded target
> 
> 
> Hello everybody,
> 
> I've been making a led-test program for my 68040 target.
> Everything compiles fine (both the making of the 
> cross-compiler and the test
> program).
> 
> However, the linker-script i'm making has a few problems. 
> (caused by me no
> doubt.)
> 
> I got a flash rom and some ram in my board.
> The first 4 bytes of the flash should be the stack-pointer 
> (0x0B40000), the
> following 4 bytes should be the start address of my program 
> ('main', which
> should be at 0x400).
> 
> I have been looking at the info-pages of the 'ld', but i 
> don't really know
> how to force those constants at 0x0 and 0x4.
> 
> This might be somewhat a newbie question, but i'm kind of stuck to be
> honest.
> I will include my linker script with which i'm toying at the moment.
> 
> ----8<--------
> 
> OUTPUT_ARCH(m68k)   /* Specify the output machine 
> architecture to be m68k.
> */
> OUTPUT_FORMAT(ieee) /* Output format. Should be srec (S-records).*/
>                     /* Same as the --oformat command-line 
> option.       */
> 
> PROVIDE (__stack = 0x0B40000);
> 
> ENTRY(main);
> 
> MEMORY
> {
>   /* Flash; Read-only, execute     */
>   rom1 (rx): ORIGIN = 0x0,         LENGTH = 512K
>   /* Internal SRAM; RW, no execute */
>   ramcode (rwx): ORIGIN = 0x800000, LENGTH = 2048K
>   ramdata (rw): ORIGIN = 0x0A00000, LENGTH = 2048K
> }
> 
> SECTIONS {
>   .vector0 :
>     { . = 0x0} = __stack;
>   .vector1 :
>     { . = 0x4} = &main;
>   .text :
>     { 
>     *(.text)
>     } > rom1
>   .data :
>     { 
>     *(.data)
>     } > rom1
>   .bss  :
>     { 
>     *(.bss)
>       end = ALIGN(0x8);
>     } > ramdata
> }
> 
> ----8<---------
> 
> Best regards, and thanks,
> Jan Vermeulen
> 
> 
> ------
> Want more information?  See the CrossGCC FAQ, 
http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to
crossgcc-unsubscribe@sourceware.cygnus.com
###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/

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


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