Re: Handling __flash1 and .trampolines [Was: .trampolines location.]

Erik Christiansen <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <20121212130410.GB2011@ratatosk>
On 11.12.12 14:42, Jan Waclawek wrote:
> There are several ways to approach that, as I wrote in the places I
> referred to before. For "segmented" access (i.e. ELPM with constant
> high address byte, which is what __flashN is about), you need to
> ensure that the data is located not below the 0xN0000 address (0x10000
> for __flash1).

AIUI, an AVR physical page starts _on_ 0xN0000, so that would seem to be
where __flashN has to start. When __memx is used, at least __flash1 must
be empty, IIUC what Johann so lucidly describes.

> At the same time, if .text reaches above 0xN0000, it should not
> overlap these data, rather, it should "push" them upwards.

AIUI, we use either 16-bit addressing, which is explicitly paged, or
24-bit addressing (__memx), which is not. In the latter case, the output
sections stack without effort, given a suitable linker script. In the
former, overlap must be detected.

> Alternatively, the data could be located in a reverse order from top
> of the segment. IMHO there's no support for either in the current
> linker (I am no ld guru so I may easily be wrong).

s/linker/linker script/

The required linker script modifications look eminently manageable so
far. It is cramming two contrary use cases into one linker script which
makes it less straightforward. (And therefore more interesting. :-)

Erik

-- 
Duct tape is like the force. It has a light side, and a dark side, and
it holds the universe together.
                                                         - Carl Zwanzig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.