summaryrefslogtreecommitdiff
path: root/gcc/config/avr
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/avr')
-rw-r--r--gcc/config/avr/avr-arch.h4
-rw-r--r--gcc/config/avr/avr-mcus.def10
-rw-r--r--gcc/config/avr/avr.c8
-rw-r--r--gcc/config/avr/avr.opt4
-rw-r--r--gcc/config/avr/gen-avr-mmcu-specs.c5
-rw-r--r--gcc/config/avr/specs.h3
6 files changed, 25 insertions, 9 deletions
diff --git a/gcc/config/avr/avr-arch.h b/gcc/config/avr/avr-arch.h
index 42eaee56b7b..a740a151105 100644
--- a/gcc/config/avr/avr-arch.h
+++ b/gcc/config/avr/avr-arch.h
@@ -157,7 +157,9 @@ enum avr_device_specific_features
AVR_ISA_NONE,
AVR_ISA_RMW = 0x1, /* device has RMW instructions. */
AVR_SHORT_SP = 0x2, /* Stack Pointer has 8 bits width. */
- AVR_ERRATA_SKIP = 0x4 /* device has a core erratum. */
+ AVR_ERRATA_SKIP = 0x4, /* device has a core erratum. */
+ AVR_ISA_LDS = 0x8 /* whether LDS / STS is valid for all data in static
+ storage. Only useful for reduced Tiny. */
};
/* Map architecture to its texinfo string. */
diff --git a/gcc/config/avr/avr-mcus.def b/gcc/config/avr/avr-mcus.def
index 6bcc6ff08ae..e5b4cdaf660 100644
--- a/gcc/config/avr/avr-mcus.def
+++ b/gcc/config/avr/avr-mcus.def
@@ -341,11 +341,11 @@ AVR_MCU ("atxmega128a1u", ARCH_AVRXMEGA7, AVR_ISA_RMW, "__AVR_ATxmega128A1U_
AVR_MCU ("atxmega128a4u", ARCH_AVRXMEGA7, AVR_ISA_RMW, "__AVR_ATxmega128A4U__", 0x2000, 0x0, 3)
/* Tiny family */
AVR_MCU ("avrtiny", ARCH_AVRTINY, AVR_ISA_NONE, NULL, 0x0040, 0x0, 1)
-AVR_MCU ("attiny4", ARCH_AVRTINY, AVR_ISA_NONE, "__AVR_ATtiny4__", 0x0040, 0x0, 1)
-AVR_MCU ("attiny5", ARCH_AVRTINY, AVR_ISA_NONE, "__AVR_ATtiny5__", 0x0040, 0x0, 1)
-AVR_MCU ("attiny9", ARCH_AVRTINY, AVR_ISA_NONE, "__AVR_ATtiny9__", 0x0040, 0x0, 1)
-AVR_MCU ("attiny10", ARCH_AVRTINY, AVR_ISA_NONE, "__AVR_ATtiny10__", 0x0040, 0x0, 1)
-AVR_MCU ("attiny20", ARCH_AVRTINY, AVR_ISA_NONE, "__AVR_ATtiny20__", 0x0040, 0x0, 1)
+AVR_MCU ("attiny4", ARCH_AVRTINY, AVR_ISA_LDS, "__AVR_ATtiny4__", 0x0040, 0x0, 1)
+AVR_MCU ("attiny5", ARCH_AVRTINY, AVR_ISA_LDS, "__AVR_ATtiny5__", 0x0040, 0x0, 1)
+AVR_MCU ("attiny9", ARCH_AVRTINY, AVR_ISA_LDS, "__AVR_ATtiny9__", 0x0040, 0x0, 1)
+AVR_MCU ("attiny10", ARCH_AVRTINY, AVR_ISA_LDS, "__AVR_ATtiny10__", 0x0040, 0x0, 1)
+AVR_MCU ("attiny20", ARCH_AVRTINY, AVR_ISA_LDS, "__AVR_ATtiny20__", 0x0040, 0x0, 1)
AVR_MCU ("attiny40", ARCH_AVRTINY, AVR_ISA_NONE, "__AVR_ATtiny40__", 0x0040, 0x0, 1)
/* Assembler only. */
AVR_MCU ("avr1", ARCH_AVR1, AVR_ISA_NONE, NULL, 0x0060, 0x0, 1)
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 7ad2b6422b0..b6899a4b69a 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -10182,14 +10182,18 @@ avr_encode_section_info (tree decl, rtx rtl, int new_decl_p)
&& SYMBOL_REF_P (XEXP (rtl, 0)))
{
rtx sym = XEXP (rtl, 0);
+ bool progmem_p = -1 == avr_progmem_p (decl, DECL_ATTRIBUTES (decl));
- if (-1 == avr_progmem_p (decl, DECL_ATTRIBUTES (decl)))
+ if (progmem_p)
{
// Tag symbols for later addition of 0x4000 (AVR_TINY_PM_OFFSET).
SYMBOL_REF_FLAGS (sym) |= AVR_SYMBOL_FLAG_TINY_PM;
}
if (avr_decl_absdata_p (decl, DECL_ATTRIBUTES (decl))
+ || (TARGET_ABSDATA
+ && !progmem_p
+ && !addr_attr)
|| (addr_attr
// If addr_attr is non-null, it has an argument. Peek into it.
&& TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (addr_attr))) < 0xc0))
@@ -10198,7 +10202,7 @@ avr_encode_section_info (tree decl, rtx rtl, int new_decl_p)
SYMBOL_REF_FLAGS (sym) |= AVR_SYMBOL_FLAG_TINY_ABSDATA;
}
- if (-1 == avr_progmem_p (decl, DECL_ATTRIBUTES (decl))
+ if (progmem_p
&& avr_decl_absdata_p (decl, DECL_ATTRIBUTES (decl)))
{
error ("%q+D has incompatible attributes %qs and %qs",
diff --git a/gcc/config/avr/avr.opt b/gcc/config/avr/avr.opt
index 1af792b8df0..9ad6c5ab8d7 100644
--- a/gcc/config/avr/avr.opt
+++ b/gcc/config/avr/avr.opt
@@ -99,6 +99,10 @@ mfract-convert-truncate
Target Report Mask(FRACT_CONV_TRUNC)
Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
+mabsdata
+Target Report Mask(ABSDATA)
+Assume that all data in static storage can be accessed by LDS / STS. This option is only useful for reduced Tiny devices.
+
nodevicelib
Driver Target Report RejectNegative
Do not link against the device-specific library lib<MCU>.a.
diff --git a/gcc/config/avr/gen-avr-mmcu-specs.c b/gcc/config/avr/gen-avr-mmcu-specs.c
index 7fca756ae62..9ea987f6add 100644
--- a/gcc/config/avr/gen-avr-mmcu-specs.c
+++ b/gcc/config/avr/gen-avr-mmcu-specs.c
@@ -130,6 +130,7 @@ print_mcu (const avr_mcu_t *mcu)
FILE *f = fopen (name ,"w");
+ bool absdata = 0 != (mcu->dev_attribute & AVR_ISA_LDS);
bool errata_skip = 0 != (mcu->dev_attribute & AVR_ERRATA_SKIP);
bool rmw = 0 != (mcu->dev_attribute & AVR_ISA_RMW);
bool sp8 = 0 != (mcu->dev_attribute & AVR_SHORT_SP);
@@ -189,6 +190,10 @@ print_mcu (const avr_mcu_t *mcu)
? "\t%{!mno-skip-bug: -mskip-bug}"
: "\t%{!mskip-bug: -mno-skip-bug}");
+ fprintf (f, "*cc1_absdata:\n%s\n\n", absdata
+ ? "\t%{!mno-absdata: -mabsdata}"
+ : "\t%{mabsdata}");
+
// avr-gcc specific specs for assembling / the assembler.
fprintf (f, "*asm_arch:\n\t-mmcu=%s\n\n", arch->name);
diff --git a/gcc/config/avr/specs.h b/gcc/config/avr/specs.h
index 52763cc607a..222ad5badae 100644
--- a/gcc/config/avr/specs.h
+++ b/gcc/config/avr/specs.h
@@ -34,7 +34,8 @@ along with GCC; see the file COPYING3. If not see
#define CC1_SPEC \
"%(cc1_n_flash) " \
"%(cc1_errata_skip) " \
- "%(cc1_rmw) "
+ "%(cc1_rmw) " \
+ "%(cc1_absdata) "
#undef CC1PLUS_SPEC
#define CC1PLUS_SPEC \