avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] fixed address for PROGMEM


From: Erik Christiansen
Subject: Re: [avr-gcc-list] fixed address for PROGMEM
Date: Fri, 7 Nov 2003 12:24:32 +1100
User-agent: Mutt/1.3.28i

On Thu, Nov 06, 2003 at 07:31:04PM +0100, Joerg Wunsch wrote:
> As "E.Weddington" <address@hidden> wrote:
> 
> >You *might* be able to relocate the entire section, though. 
> >The section name is .progmem.data. Warning: completely 
> >untried and untested.
> 
> IMHO, this requires a custom linker script.

Taking a quick peek at one of the linker scripts that I found in
/usr/local/avr/avr/lib/ldscripts, progmem appears only twice,

    *(.progmem.gcc*)
    *(.progmem*)

both in the middle of the .text section. To put .progmem.data at a
preferred location, I'd cut & paste the second line to a new section.
(i.e. put this within the "SECTIONS { ... }", after any other "> text"
locations:

   Flash_End = 0x1234567890 ;        /* We want it to _end_ here. */

   .elephant : AT (Flash_End - SIZEOF (.elephant))
   {
    *(.progmem*)
   } > text

Now any .progmem.data should end up in the .elephant section, at the top
of the text segment, i.e. program memory.

There are some caveats. I can't stop to test it today, so a tweak may be
needed if it doesn't work first off. ("info ld" is a goldmine, and I'll
try to help.) Second, I'm not familiar with PROGMEM, and am inferring
from context that it is data gumpf that begins its life in program Flash.

If ld doesn't know SIZEOF (.elephant) as it begins to locate it, then
we'll have to fiddle a bit.

Have fun,
Erik


reply via email to

[Prev in Thread] Current Thread [Next in Thread]