From 156f0561f2e9865eb76a79742d8224cdd7100f27 Mon Sep 17 00:00:00 2001 From: Stefan Kerkmann Date: Sun, 27 Feb 2022 04:05:03 +0100 Subject: [Core] Squeeze AVR some more with `-mrelax` and `-mcall-prologues` (#16269) --- platforms/avr/platform.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'platforms/avr/platform.mk') diff --git a/platforms/avr/platform.mk b/platforms/avr/platform.mk index 4d9cafaeef..9f304d2e20 100644 --- a/platforms/avr/platform.mk +++ b/platforms/avr/platform.mk @@ -18,6 +18,13 @@ COMPILEFLAGS += -ffunction-sections COMPILEFLAGS += -fdata-sections COMPILEFLAGS += -fpack-struct COMPILEFLAGS += -fshort-enums +COMPILEFLAGS += -mcall-prologues + +# Linker relaxation is only possible if +# link time optimizations are not enabled. +ifeq ($(strip $(LTO_ENABLE)), no) + COMPILEFLAGS += -mrelax +endif ASFLAGS += $(AVR_ASFLAGS) @@ -28,7 +35,7 @@ CFLAGS += -fno-strict-aliasing CXXFLAGS += $(COMPILEFLAGS) CXXFLAGS += -fno-exceptions -std=c++11 -LDFLAGS +=-Wl,--gc-sections +LDFLAGS += -Wl,--gc-sections OPT_DEFS += -DF_CPU=$(F_CPU)UL -- cgit v1.2.3 From b1681fb6a11e6eb286bc93af3bcc59422e054eb8 Mon Sep 17 00:00:00 2001 From: Stefan Kerkmann Date: Fri, 22 Apr 2022 10:13:31 +0200 Subject: [Core] Allow usage of AVRs minimal printf library (#16266) Co-authored-by: Sergey Vlasov --- platforms/avr/platform.mk | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'platforms/avr/platform.mk') diff --git a/platforms/avr/platform.mk b/platforms/avr/platform.mk index 9f304d2e20..0374e2e058 100644 --- a/platforms/avr/platform.mk +++ b/platforms/avr/platform.mk @@ -37,6 +37,15 @@ CXXFLAGS += -fno-exceptions -std=c++11 LDFLAGS += -Wl,--gc-sections +# Use AVR's libc minimal printf implementation which has less features +# and thus can shave ~400 bytes. Usually we use the xprintf +# implementation but keyboards that use s(n)printf automatically +# pull in the AVR libc implementation, which is ~900 bytes heavy. +AVR_USE_MINIMAL_PRINTF ?= no +ifeq ($(strip $(AVR_USE_MINIMAL_PRINTF)), yes) + LDFLAGS += -Wl,--whole-archive -lprintf_min -Wl,--no-whole-archive +endif + OPT_DEFS += -DF_CPU=$(F_CPU)UL MCUFLAGS = -mmcu=$(MCU) -- cgit v1.2.3 From 6503987c84994b2c6b5229db8b91c14d8bd11e41 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Wed, 18 May 2022 11:06:55 +0100 Subject: Workaround for recent -Werror=array-bounds AVR issues (#17136) --- platforms/avr/platform.mk | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'platforms/avr/platform.mk') diff --git a/platforms/avr/platform.mk b/platforms/avr/platform.mk index 0374e2e058..978199b385 100644 --- a/platforms/avr/platform.mk +++ b/platforms/avr/platform.mk @@ -12,6 +12,11 @@ HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) BIN = +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523 +ifneq ($(findstring 12.,$(shell avr-gcc --version 2>/dev/null)),) +COMPILEFLAGS += --param=min-pagesize=0 +endif + COMPILEFLAGS += -funsigned-char COMPILEFLAGS += -funsigned-bitfields COMPILEFLAGS += -ffunction-sections -- cgit v1.2.3