This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Re: Linker options for dividing flash


> Is this what you refer to? Ie. I set RAMSTART, RAMSIZE
> etc. individually for each of the three sections? I've never tried
> this, so can I invoke the linker command with something like:
> 
> <target>-ld -DRAMSTART=0x400 ...

If you look in the Makefile, you'll see I use a sed script
to change those text markers to real numbers in separate files.
I.e.:

sed s/ROMSTART/0xf000/g < template.ld > block1.ld
sed s/ROMSTART/0xe000/g < template.ld > block2.ld
sed s/ROMSTART/0xc000/g < template.ld > block3.ld

> And RAMSTART gets substituted in the linker script?

The script I use replaces many variables, that's one of them.  It's
done at libgloss build time, not by the linker.

> And the way I control the entry address with respect to the begin of
> the section is by writing the startup file accordingly and have it
> be the first file passed to the linker?

Yes.  One of the things the linker script is good at is making sure
specific objects get linked at specific locations.

> This sounds simple. I'll try it out. Just that... would it be
> possible that entry address is controlled even when the files passed
> to the linker are out of order? I am considering creating a section
> for the startup file and put it in the beginning of the linker
> script.

The linker script can find objects by name and force them to be linked
in a specific order, regardless of the order they're presented on the
command line.  However, gcc usually arranges for crt0.o to be the
first object passed to the linker anyway.  It's up to you to choose
one (or more) ways of ensuring this, but there are ways.


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