aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Whittington <git@jbrengineering.co.uk>2020-02-24 09:58:20 +0100
committerJohn Whittington <git@jbrengineering.co.uk>2020-02-24 09:58:20 +0100
commite6574e3c7217ff5402f00517580a2245de0efd67 (patch)
tree5d5f55201121778d56c7f2af0c70acefd4bc985b
parent93b251a4e1379378d07f2607c7f15b44e2c545a4 (diff)
switch compliler flags to prevent AR fail on ARM
-rw-r--r--Arduino.mk23
1 files changed, 16 insertions, 7 deletions
diff --git a/Arduino.mk b/Arduino.mk
index b9611a0..ea780f2 100644
--- a/Arduino.mk
+++ b/Arduino.mk
@@ -1227,15 +1227,24 @@ CFLAGS += $(CFLAGS_STD)
CXXFLAGS += -fpermissive -fno-exceptions $(CXXFLAGS_STD)
ASFLAGS += -x assembler-with-cpp
DIAGNOSTICS_COLOR_WHEN ?= always
-ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)
- ASFLAGS += -flto
- CXXFLAGS += -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
- CFLAGS += -flto -fno-fat-lto-objects -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
+
+# Flags for AVR
+ifeq ($(findstring avr, $(strip $(CC_NAME))), avr)
+ ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)
+ ASFLAGS += -flto
+ CXXFLAGS += -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
+ CFLAGS += -flto -fno-fat-lto-objects -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
+ LDFLAGS += -flto -fuse-linker-plugin
+ endif
+# Flags for ARM (most set in Sam.mk)
+else
+ ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)
+ CXXFLAGS += -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
+ CFLAGS += -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
+ endif
endif
+
LDFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -Wl,--gc-sections -O$(OPTIMIZATION_LEVEL)
-ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)
- LDFLAGS += -flto -fuse-linker-plugin
-endif
SIZEFLAGS ?= --mcu=$(MCU) -C
# for backwards compatibility, grab ARDUINO_PORT if the user has it set