This adds to the documentation a hint how to set up a linker description file that avoids progmem altogether any without the usual overhead of locating read-only data in RAM. The proposed linker description file is completely transparent to the compiler, and no start-up code has to be adjusted.

IIUC there are currently no plans to fix this in the default linker description file avrtiny.x, cf. http://sourceware.org/PR20849

Also, link between -mabsdata option and absdata variable attribute.

Ok for trunk?


Johann


gcc/
        * doc/invoke.texi (AVR Options) [-mabsdata]: Point to absdata.
        * doc/extend.texi (AVR Variable Attributes) [progmem]: Hint
        about linker description to avoid progmem altogether.
        [absdata]: Point to -mabsdata option.

Index: doc/extend.texi
===================================================================
--- doc/extend.texi	(revision 243111)
+++ doc/extend.texi	(working copy)
@@ -5929,6 +5929,30 @@ int read_var (int i)
 @}
 @end smallexample
 
+Please notice that on these devices, there is no need for @code{progmem}
+at all.  Just use an appropriate linker description file like outlined below.
+
+@smallexample
+  .text :
+  @{ ...
+  @} > text
+  /* Leave .rodata in flash and add an offset of 0x4000 to all
+     addresses so that respective objects can be accessed by LD
+     instructions and open coded C/C++.  This means there is no
+     need for progmem in the source and no overhead by read-only
+     data in RAM.  */
+  .rodata ADDR(.text) + SIZEOF (.text) + 0x4000 :
+  @{
+    *(.rodata)
+    *(.rodata*)
+    *(.gnu.linkonce.r*)
+  @} AT> text
+  /* No more need to put .rodata into .data:
+     Removed all .rodata entries from .data.  */
+  .data :
+  @{ ...
+@end smallexample
+
 @end table
 
 @item io
@@ -6001,6 +6025,8 @@ warning like
 
 @end itemize
 
+See also the @option{-mabsdata} @ref{AVR Options,command-line option}.
+
 @end table
 
 @node Blackfin Variable Attributes
Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 243111)
+++ doc/invoke.texi	(working copy)
@@ -15402,7 +15402,8 @@ GCC supports the following AVR devices a
 
 Assume that all data in static storage can be accessed by LDS / STS
 instructions.  This option has only an effect on reduced Tiny devices like
-ATtiny40.
+ATtiny40.  See also the @code{absdata}
+@ref{AVR Variable Attributes,variable attribute}.
 
 @item -maccumulate-args
 @opindex maccumulate-args

Reply via email to