[Patch, avr] Place progmem.data from avr-libc above other progmem
Senthil Kumar Selvaraj
senthil_kumar.selvaraj@atmel.com
Sat May 14 18:41:00 GMT 2016
Hi,
avr-libc's vfprint handling uses a lookup table located in flash
if float format specifiers are involved. If user code also has
lots of flash data (in section .progmem.data), then
avr-libc's progmem data gets pushed beyond the 64 K word limit. The
avr-libc code doesn't expect this to happen and vfprintf stops working correctly.
User code can easily use the memx address space modifier to
seamlessly access flash data above 64K. The avr-libc project doesn't
use address space modifiers yet, and the lookup logic itself is
written in assembly, so I guess it is not going to gain this ability
soon.
Given these constraints, this patch places progmem.data coming from
avr-libc's routines above other progmem.data, increasing the
likelyhood that it gets placed below the 64 K limit. If this is ok,
could someone commit please? I don't have commit access.
Regards
Senthil
2016-05-15 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* scripttempl/avr.sc (text): Place .progmem.data
from avr-libc above .progmem*.
* scripttempl/avrtiny.sc (text): Likewise.
diff --git ld/scripttempl/avr.sc ld/scripttempl/avr.sc
index c26f4ea..80064cb 100644
--- ld/scripttempl/avr.sc
+++ ld/scripttempl/avr.sc
@@ -113,6 +113,10 @@ SECTIONS
${RELOCATING+ *(.trampolines*)}
${CONSTRUCTING+ __trampolines_end = . ; }
+ /* avr-libc expects these data to reside in lower 64K. */
+ *libprintf_flt.a:*(.progmem.data)
+ *libc.a:*(.progmem.data)
+
${RELOCATING+ *(.progmem*)}
${RELOCATING+. = ALIGN(2);}
diff --git ld/scripttempl/avrtiny.sc ld/scripttempl/avrtiny.sc
index 0441dcb..234c7c7 100644
--- ld/scripttempl/avrtiny.sc
+++ ld/scripttempl/avrtiny.sc
@@ -113,6 +113,9 @@ SECTIONS
${RELOCATING+ *(.trampolines*)}
${CONSTRUCTING+ __trampolines_end = . ; }
+ /* avr-libc expects these data to reside in lower 64K. */
+ *libprintf_flt.a:*(.progmem.data)
+ *libc.a:*(.progmem.data)
${RELOCATING+ *(.progmem*)}
${RELOCATING+. = ALIGN(2);}
More information about the Binutils
mailing list