summaryrefslogtreecommitdiff
path: root/platforms
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-04-22 10:13:31 +0200
committerGitHub <noreply@github.com>2022-04-22 18:13:31 +1000
commitb1681fb6a11e6eb286bc93af3bcc59422e054eb8 (patch)
treec1d41030249f2d187eca4f11281765ef9e78567f /platforms
parent68a3fe8347ff76e96075dab17cb9c4ac81ecf634 (diff)
[Core] Allow usage of AVRs minimal printf library (#16266)
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
Diffstat (limited to 'platforms')
-rw-r--r--platforms/avr/platform.mk9
1 files changed, 9 insertions, 0 deletions
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)