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]

[Fwd: Re: Overlay sections, linking and copying]


Hi all!,
my problem now is that, if I didn't understand wrong, I think I want to
use this in a different way in which it was designed.

My problem is that the image is going to be stored in a spi flash and will
be loaded into ram when booting.

By then, I want to be able to know which address are the overlays stored
in flash in order to copy them to the overlay section in ram.

As long as I understand now, the overlay section in ram will be determined
correctly by the linker script and I can know it from before but the
problem is in the spi flash.

How can I know where are my overlays living?.
By now, I'm starting with this in the linker script but I think I'm
failing in the definition of address_in_flash in the OVERLAY heading.

address_overlay_1 = .;

    OVERLAY address_overlay_1 : NOCROSSREFS address_in_flash
    {
        .MOD1 {MOD1/*.o (.text)}
        .MOD2 {MOD2/*.o (.text)}
        .MOD3 {MOD3/*.o (.text)}
    }

Of course I need to declare the address in which the overlay section has
to live in the ram but the address in which the overlaid modules live
should be far away from there in another memory or so which is what the
manual says, a slower memory. My slower memory is a spi flash and the
executable is stored there and copied to ram when booting so everything
will be copied to ram and I don't want my overlaid modules to be copied to
ram. Just copy the module I want to the overlay section I need because I
want to save ram.

Maybe you can understand the problem now, I just want to get to know in
execution time where my modules are living in flash to be able to copy
them to ram and I don't know how to export the symbols to be able to do
this.What is more, modules should never be copied to ram but when they're
going to be copied to the overlay section.


Best Regards,
Ignacio





---------------------------- Original Message ----------------------------
Subject: Re: Overlay sections, linking and copying
From:    "Ignacio Subira" <ignacio.subira@gigle.biz>
Date:    Wed, August 5, 2009 9:22 am
To:      "Alan Modra" <amodra@bigpond.net.au>
--------------------------------------------------------------------------

Hi Alan!,

thanks for the information, I had read a manual of ld but seems to me that
wasn't up to date.
I downloaded the full source code for binutils and read the documentation
there and it appeared.

What I think I'm going to do is reference the addresses using labels in
the linker script for the flash image and the __load_start and __load_end
for the sectors in ram.

I'll be investigating a little more just to guess a way to make this a
little more intelligent because by know I need to write the software
specifically to the labels I write in the linker script and I'd like it to
be more automatic.

If anyone wants me to post the code or has curiosity, just let me know.

Thanks,
Ignacio


> On Tue, Aug 04, 2009 at 01:01:58PM +0200, Ignacio Subira wrote:
>> Until now, I've read enough to be able to design the overlay structure
>> in
>> the linker script and store the complete binary in the flash of my
>> device.
>> The problem comes now when I want to load the pieces of code, where do I
>> have to look for them in flash?, where are them stored in the binary?,
>> in
>> what address do they start and end?.
>
> As the ld info doc states, the linker defines __load_start_<secname>
> and __load_stop_<secname> symbols for each overlay.  You can reference
> these symbols to build a table of load addresses.
>
> --
> Alan Modra
> Australia Development Lab, IBM
>




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