Specifiying memory layout

Ian Lance Taylor ian@wasabisystems.com
Wed Jun 9 20:34:00 GMT 2004


Shaun Jackman <sjackman@telus.net> writes:

> I'm linking an executable for an embedded system with 1 MB of memory 
> starting at 0x02000000. I understand the following is the one line of 
> a linker script that would have the desired effect.
> 
> MEMORY {	ram : ORIGIN = 0x02000000, LENGTH = 1024k }
> 
> Can I use this line on it's own as a one line linker script? Should I 
> tack this line onto the end of gcc's armelf.x and use the resulting 
> linker script?

No.  The memory regions will only be used for sections which are
specifically directed to be in those memory regions.

The quick way to do what you want is to copy the default linker script
and edit it to set the desired address at the first assignment to "."
in the SECTIONS command.  You can find the default linker script at
something like /usr/local/TARGET/lib/ldscripts/NAME.x.

> If I can avoid using a linker script at all, that'd be good too! Can I 
> specify these parameters on the command line?

Not really, unfortunately.

Ian



More information about the Binutils mailing list