From f4203b2b8830e66e5229b7f9d30cd29b088566b5 Mon Sep 17 00:00:00 2001 From: eorg-Johann Lay Date: Fri, 19 May 2017 15:06:33 +0100 Subject: Update avrxmega3 linker emulation to support avrxmega2 devices with flash memory visible in the SRAM address range. PR ld/21472 ld * emulparams/avrxmega3.sh (RODATA_PM_OFFSET): Set to 0x8000. * scripttempl/avr.sc (__RODATA_PM_OFFSET__) [RODATA_PM_OFFSET]: Use RODATA_PM_OFFSET as default if not already defined. (.data) [!RODATA_PM_OFFSET]: Don't include .rodata and friends. (.rodata) [RODATA_PM_OFFSET]: Put at an offset of __RODATA_PM_OFFSET__. gas * config/tc-avr.c (mcu_types): Add entries for: attiny416, attiny417, attiny816, attiny817. --- gas/ChangeLog | 6 ++++++ gas/config/tc-avr.c | 4 ++++ ld/ChangeLog | 10 +++++++++ ld/emulparams/avrxmega3.sh | 1 + ld/scripttempl/avr.sc | 51 +++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 71 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 8605e59..e96a59c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2017-05-19 Georg-Johann Lay + + PR ld/21472 + * config/tc-avr.c (mcu_types): Add entries for: attiny416, + attiny417, attiny816, attiny817. + 2017-05-18 Alan Modra * config/tc-aarch64.c: Don't compare booleans against TRUE or FALSE. diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c index 7214c07..79837c8 100644 --- a/gas/config/tc-avr.c +++ b/gas/config/tc-avr.c @@ -300,6 +300,10 @@ static struct mcu_type_s mcu_types[] = {"atxmega16e5", AVR_ISA_XMEGA, bfd_mach_avrxmega2}, {"atxmega8e5", AVR_ISA_XMEGA, bfd_mach_avrxmega2}, {"atxmega32x1", AVR_ISA_XMEGA, bfd_mach_avrxmega2}, + {"attiny416", AVR_ISA_XMEGA, bfd_mach_avrxmega3}, + {"attiny417", AVR_ISA_XMEGA, bfd_mach_avrxmega3}, + {"attiny816", AVR_ISA_XMEGA, bfd_mach_avrxmega3}, + {"attiny817", AVR_ISA_XMEGA, bfd_mach_avrxmega3}, {"atxmega64a3", AVR_ISA_XMEGA, bfd_mach_avrxmega4}, {"atxmega64a3u",AVR_ISA_XMEGAU, bfd_mach_avrxmega4}, {"atxmega64a4u",AVR_ISA_XMEGAU, bfd_mach_avrxmega4}, diff --git a/ld/ChangeLog b/ld/ChangeLog index 097afac..838f3cb 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2017-05-19 Georg-Johann Lay + + PR ld/21472 + * emulparams/avrxmega3.sh (RODATA_PM_OFFSET): Set to 0x8000. + * scripttempl/avr.sc (__RODATA_PM_OFFSET__) [RODATA_PM_OFFSET]: + Use RODATA_PM_OFFSET as default if not already defined. + (.data) [!RODATA_PM_OFFSET]: Don't include .rodata and friends. + (.rodata) [RODATA_PM_OFFSET]: Put at an offset of + __RODATA_PM_OFFSET__. + 2017-05-18 Nick Clifton PR ld/21251 diff --git a/ld/emulparams/avrxmega3.sh b/ld/emulparams/avrxmega3.sh index abaa5b3..7c5a1e5 100644 --- a/ld/emulparams/avrxmega3.sh +++ b/ld/emulparams/avrxmega3.sh @@ -9,4 +9,5 @@ TEMPLATE_NAME=elf32 TEXT_LENGTH=1024K DATA_ORIGIN=0x802000 DATA_LENGTH=0xffa0 +RODATA_PM_OFFSET=0x8000 EXTRA_EM_FILE=avrelf diff --git a/ld/scripttempl/avr.sc b/ld/scripttempl/avr.sc index b889180..144d32d 100644 --- a/ld/scripttempl/avr.sc +++ b/ld/scripttempl/avr.sc @@ -4,6 +4,17 @@ # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. +# RODATA_PM_OFFSET +# If empty, .rodata sections will be part of .data. This is for +# devices where it is not possible to use LD* instructions to read +# from flash. +# +# If non-empty, .rodata is not part of .data and the .rodata +# objects are assigned addresses at an offest of RODATA_PM_OFFSET. +# This is for devices that feature reading from flash by means of +# LD* instructions, provided the addresses are offset by +# __RODATA_PM_OFFSET__ (which defaults to RODATA_PM_OFFSET). + cat < text} +EOF + +# Devices like ATtiny816 allow to read from flash memory by means of LD* +# instructions provided we add an offset of __RODATA_PM_OFFSET__ to the +# flash addresses. + +if test -n "$RODATA_PM_OFFSET"; then + cat < text} +EOF +fi +cat <