GNU linker script - how to automatically distribute code to multiple non-contiguous sections

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GNU linker script - how to automatically distribute code to multiple non-contiguous sections

Adrian Muresan
I'm modifying an existing .ld and I have two flash sections for the code. These two flash sections are not contiguous so I cannot merely extend the definition of one of the sections to include the other.

Currently all of the code can fit in sec1 but if I turn off space optimizations, it doesn't fit.

QUESTION

How do I write the .ld to say:  place as much of the code as will fit in sec1 and then as much as will fit in sec2 and then ... sec3... etc?

I know how to place specific .obj in specific section but that's not what I want because I'll need to constantly modify the .ld as my code changes.
Reply | Threaded
Open this post in threaded view
|

Re: GNU linker script - how to automatically distribute code to multiple non-contiguous sections

Florian Weimer-5
* Adrian Muresan:

> I'm modifying an existing .ld and I have two flash sections for the
> code. These two flash sections are not contiguous so I cannot merely
> extend the definition of one of the sections to include the other.
>
> Currently all of the code can fit in sec1 but if I turn off space
> optimizations, it doesn't fit.
>
> QUESTION
>
> How do I write the .ld to say: place as much of the code as will fit
> in sec1 and then as much as will fit in sec2 and then ... sec3... etc?

This is more a question for the binutils list.

Can you use the MEMORY directive and a region specifier on the output
section definition to achieve this?  (Sorry, not my area of expertise.)

Florian