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

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

[avr-gcc-list] RE: eeprom section and ld scripts


From: Bill Somerville
Subject: [avr-gcc-list] RE: eeprom section and ld scripts
Date: Sat, 25 Oct 2003 14:13:36 +0100

Bill Somerville wrote:
> 
> I am a little confused by the AVR linker scripts, perhaps someone can
> clarify.
> 
> The eeprom section looks like:
> 
>   .eeprom  :
>         AT (ADDR (.text) + SIZEOF (.text) + SIZEOF (.data))
>   {
>     *(.eeprom*)
>      __eeprom_end = . ;
>   }  > eeprom
> 
> This gives a load address which is incorrect and has to corrected before
> tools such as simulavr, uisp, and avrdude can be used.
> 
> Simply using
> 
>   .eeprom  :
>   {
>     *(.eeprom*)
>      __eeprom_end = . ;
>   }  > eeprom
> 
> seems to give the correct load address 0x00810000 and virtual address
> 0x00810000 without any section overlap errors.
> 
> Does anyone know why the LMA adjustment in the script is there?
> 
> --
> Bill Somerville

OK no responses to this post so I guess no-one understands this issue or
cares :-)

Here is a binutils patch that someone else might be able to test/apply.

Note that utilities like avrdude, uisp, and simulavr could (and should)
make use of this corrected linking to make EEPROM loading possible
without messing with load addresses. They would still need to mask off
the "Harvard" address space id bits, but at least after that the load
addresses for EEPROM would be correct. Currently EEPROM addresses are
offset by the size of text and data sections for some unknown reason.

--
Bill Somerville

binutils Patch starts here:

Index: ld/ChangeLog
===================================================================
RCS file: /cvs/src/src/ld/ChangeLog,v
retrieving revision 1.1016
diff -u -r1.1016 ChangeLog
--- ld/ChangeLog        24 Oct 2003 18:55:39 -0000      1.1016
+++ ld/ChangeLog        25 Oct 2003 13:00:17 -0000
@@ -1,3 +1,8 @@
+2003-10-25  Bill Somerville  <address@hidden>
+
+       * scripttempl/avr.sc: EEPROM has own address space and should
not
+       be linked after end of .noinit data.
+
 2003-10-24  H.J. Lu  <address@hidden>

        * ldlang.c (lang_vers_match): Fix a typo.
Index: ld/scripttempl/avr.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/avr.sc,v
retrieving revision 1.2
diff -u -r1.2 avr.sc
--- ld/scripttempl/avr.sc       1 Jun 2002 23:28:59 -0000       1.2
+++ ld/scripttempl/avr.sc       25 Oct 2003 13:00:19 -0000
@@ -144,8 +144,7 @@
     ${RELOCATING+ PROVIDE (__heap_start = .) ; }
   } ${RELOCATING+ > data}

-  .eeprom ${RELOCATING-0}:
-       ${RELOCATING+AT (ADDR (.text) + SIZEOF (.text) + SIZEOF
(.data))}
+  .eeprom :
   {
     *(.eeprom*)
     ${RELOCATING+ __eeprom_end = . ; }


reply via email to

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