@@ -59,6 +59,7 @@ INC += -I. \
59
59
ifeq ($(CHIP_FAMILY ) , samd21)
60
60
PERIPHERALS_CHIP_FAMILY =samd21
61
61
OPTIMIZATION_FLAGS ?= -Os
62
+
62
63
# TinyUSB defines
63
64
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD21 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=128 -DCFG_TUD_MSC_BUFSIZE=512
64
65
endif
@@ -101,24 +102,26 @@ ifeq ($(DEBUG), 1)
101
102
endif
102
103
else
103
104
CFLAGS += -DNDEBUG
104
- # -finline-limit can shrink the image size.
105
- # -finline-limit=80 or so is similar to not having it on.
106
- # There is no simple default value, though.
107
105
108
- # Do a default shrink for small builds.
109
- ifndef CFLAGS_INLINE_LIMIT
110
- ifeq ($(CIRCUITPY_FULL_BUILD),0)
111
- CFLAGS_INLINE_LIMIT = 50
106
+ # Do a default shrink for small builds, including all SAMD21 builds.
107
+ ifeq ($(CIRCUITPY_FULL_BUILD),0)
108
+ SHRINK_BUILD = 1
109
+ else
110
+ ifeq ($(CHIP_FAMILY), samd21)
111
+ SHRINK_BUILD = 1
112
112
endif
113
113
endif
114
114
115
- ifdef CFLAGS_INLINE_LIMIT
116
- CFLAGS += -finline-limit=$(CFLAGS_INLINE_LIMIT )
115
+ # -finline-limit can shrink the image size.
116
+ # -finline-limit=80 or so is similar to not having it on.
117
+ # There is no simple default value, though.
118
+ ifeq ($(SHRINK_BUILD), 1)
119
+ CFLAGS += -finline-limit=45
117
120
endif
118
121
119
- ifeq ($(CIRCUITPY_FULL_BUILD),0)
120
- CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20
121
- endif
122
+ # We used to do this but it seems to not reduce space any more, at least in gcc 11.
123
+ # Leave it here, commented out, just for reference.
124
+ # --param inline-unit-growth=15 --param max-inline-insns-auto=20
122
125
123
126
ifdef CFLAGS_BOARD
124
127
CFLAGS += $(CFLAGS_BOARD )
0 commit comments