diff options
| -rw-r--r-- | ports/atmel-samd/Makefile | 12 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk | 1 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk | 4 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk | 3 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk | 3 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/pybadge/mpconfigboard.mk | 1 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/pyportal/mpconfigboard.mk | 1 | ||||
| -rw-r--r-- | ports/cxd56/Makefile | 7 | ||||
| -rw-r--r-- | ports/esp32s2/Makefile | 8 | ||||
| -rw-r--r-- | ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk | 1 | ||||
| -rw-r--r-- | ports/litex/Makefile | 8 | ||||
| -rw-r--r-- | ports/mimxrt10xx/Makefile | 8 | ||||
| -rwxr-xr-x | ports/nrf/Makefile | 10 | ||||
| -rw-r--r-- | ports/nrf/boards/pca10100/mpconfigboard.mk | 3 | ||||
| -rw-r--r-- | ports/nrf/boards/simmel/mpconfigboard.mk | 4 | ||||
| -rwxr-xr-x | ports/stm/Makefile | 9 |
16 files changed, 46 insertions, 37 deletions
diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index f92e99333..25ab2c4aa 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -87,29 +87,27 @@ INC += -I. \ ifeq ($(CHIP_FAMILY), samd21) PERIPHERALS_CHIP_FAMILY=samd21 -CFLAGS += -Os -DNDEBUG +OPTIMIZATION_FLAGS ?= -Os # TinyUSB defines 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 endif ifeq ($(CHIP_FAMILY), samd51) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -CFLAGS += -Os -DNDEBUG +OPTIMIZATION_FLAGS ?= -O2 # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif ifeq ($(CHIP_FAMILY), same54) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -CFLAGS += -Os -DNDEBUG +OPTIMIZATION_FLAGS ?= -O2 # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif -# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +# option to override default optimization level, set in boards/$(BOARD)/mpconfigboard.mk +CFLAGS += $(OPTIMIZATION_FLAGS) -DNDEBUG $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY)) #Debugging/Optimization diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk index 7e44d0c72..eb02d3c27 100644 --- a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk @@ -15,4 +15,3 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANG_APA102 = 1 -OPTIMIZATION_LEVEL = 2 diff --git a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk index 9c7fe3398..71d45990b 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk +++ b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk @@ -18,3 +18,7 @@ CIRCUITPY_PS2IO = 0 CIRCUITPY_AUDIOMP3 = 0 CIRCUITPY_ULAB = 0 + +# Override optimization to keep binary small +OPTIMIZATION_FLAGS = -Os + diff --git a/ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk b/ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk index 55d6fa78e..19e341428 100644 --- a/ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk +++ b/ports/atmel-samd/boards/loc_ber_m4_base_board/mpconfigboard.mk @@ -15,3 +15,6 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANG_APA102 = 1 +# Override optimization to keep binary small +OPTIMIZATION_FLAGS = -Os + diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index e0adc11b0..c1fe011c4 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -46,3 +46,6 @@ CFLAGS_INLINE_LIMIT = 45 else CFLAGS_INLINE_LIMIT = 70 endif + +# Override optimization to keep binary small +OPTIMIZATION_FLAGS = -Os diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk index d766dbe58..7a213faf4 100644 --- a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk @@ -16,4 +16,3 @@ CIRCUITPY_GAMEPADSHIFT = 1 CIRCUITPY_STAGE = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge -OPTIMIZATION_LEVEL = 2 diff --git a/ports/atmel-samd/boards/pyportal/mpconfigboard.mk b/ports/atmel-samd/boards/pyportal/mpconfigboard.mk index 66badb741..149141a4e 100644 --- a/ports/atmel-samd/boards/pyportal/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pyportal/mpconfigboard.mk @@ -10,4 +10,3 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C" LONGINT_IMPL = MPZ -OPTIMIZATION_LEVEL = 2 diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index 8a23059b7..b3e104e1e 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -107,7 +107,6 @@ CFLAGS += \ -Dmain=spresense_main \ -D_estack=__stack \ -c \ - -Os \ -pipe \ -std=gnu11 \ -mcpu=cortex-m4 \ @@ -123,10 +122,10 @@ CFLAGS += \ -fdata-sections \ -Wall \ +OPTIMIZATION_FLAGS ?= -O2 + # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +CFLAGS += $(OPTIMIZATION_FLAGS) LIBM = "${shell "$(CC)" $(CFLAGS) -print-file-name=libm.a}" diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index f094150d7..9415f42f2 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -101,18 +101,18 @@ CFLAGS += -DSTACK_CANARY_VALUE=0xa5a5a5a5 #Debugging/Optimization ifeq ($(DEBUG), 1) CFLAGS += -ggdb + OPTIMIZATION_FLAGS ?= -Og # You may want to enable these flags to make setting breakpoints easier. # CFLAGS += -fno-inline -fno-ipa-sra else - CFLAGS += -Os -DNDEBUG -ggdb3 + CFLAGS += -DNDEBUG -ggdb3 + OPTIMIZATION_FLAGS ?= -O2 # TODO: Test with -flto ### CFLAGS += -flto endif # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +CFLAGS += $(OPTIMIZATION_FLAGS) CFLAGS += $(INC) -Werror -Wall -mlongcalls -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk b/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk index 70caacf87..6e7627265 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.mk @@ -17,4 +17,3 @@ CIRCUITPY_ESP_FLASH_FREQ=40m CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_MODULE=wroom -OPTIMIZATION_LEVEL = 2 diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 6f083e5d4..612953daa 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -77,16 +77,16 @@ ifeq ($(DEBUG), 1) CFLAGS += -ggdb # You may want to enable these flags to make setting breakpoints easier. CFLAGS += -fno-inline -fno-ipa-sra + OPTIMIZATION_FLAGS ?= -Og else - CFLAGS += -Os -DNDEBUG -ggdb3 + CFLAGS += -DNDEBUG -ggdb3 + OPTIMIZATION_FLAGS ?= -O2 # TODO: Test with -flto ### CFLAGS += -flto endif # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +CFLAGS += $(OPTIMIZATION_FLAGS) CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index bfc73d638..917718810 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -105,13 +105,13 @@ CFLAGS += \ -DCPU_$(CHIP_VARIANT) \ -DDEBUG \ -DIMXRT10XX \ - -Os -g3 -Wno-unused-parameter \ + -g3 -Wno-unused-parameter \ -ffunction-sections -fdata-sections -fstack-usage +OPTIMIZATION_FLAGS ?= -O2 + # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +CFLAGS += $(OPTIMIZATION_FLAGS) LD_FILES = $(wildcard boards/$(BOARD)/*.ld) $(addprefix linking/, flash/$(FLASH).ld chip_family/$(CHIP_FAMILY).ld common.ld) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index d3c311e3f..3251aaa8e 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -86,16 +86,16 @@ INC += -I../../supervisor/shared/usb #Debugging/Optimization ifeq ($(DEBUG), 1) - CFLAGS += -ggdb3 -Og + CFLAGS += -ggdb3 + OPTIMIZATION_FLAGS = -Og else - CFLAGS += -Os -DNDEBUG -ggdb3 + OPTIMIZATION_FLAGS ?= -O2 + CFLAGS += -DNDEBUG -ggdb3 CFLAGS += -flto -flto-partition=none endif # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +CFLAGS += $(OPTIMIZATION_FLAGS) CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) diff --git a/ports/nrf/boards/pca10100/mpconfigboard.mk b/ports/nrf/boards/pca10100/mpconfigboard.mk index 318bc0206..e15bf3a67 100644 --- a/ports/nrf/boards/pca10100/mpconfigboard.mk +++ b/ports/nrf/boards/pca10100/mpconfigboard.mk @@ -30,3 +30,6 @@ SUPEROPT_GC = 0 # These defines must be overridden before mpconfigboard.h is included, which is # why they are passed on the command line. CFLAGS += -DSPIM3_BUFFER_SIZE=0 -DSOFTDEVICE_RAM_SIZE='(32*1024)' + +# Override optimization to keep binary small +OPTIMIZATION_FLAGS = -Os diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index 2bca2492f..cad3a965c 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -32,3 +32,7 @@ CIRCUITPY_WATCHDOG = 1 # These defines must be overridden before mpconfigboard.h is included, which is # why they are passed on the command line. CFLAGS += -DSPIM3_BUFFER_SIZE=0 -DSOFTDEVICE_RAM_SIZE='(32*1024)' -DNRFX_SPIM3_ENABLED=0 + +# Override optimization to keep binary small +OPTIMIZATION_FLAGS = -Os + diff --git a/ports/stm/Makefile b/ports/stm/Makefile index 411d8146c..5865ca845 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -85,16 +85,15 @@ ifeq ($(DEBUG), 1) # You may want to enable these flags to make setting breakpoints easier. CFLAGS += -fno-inline -fno-ipa-sra else - CFLAGS += -Os -DNDEBUG + CFLAGS += -DNDEBUG + OPTIMIZATION_FLAGS ?= -O2 CFLAGS += -ggdb3 # TODO: Test with -flto # CFLAGS += -flto endif -# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk -ifdef OPTIMIZATION_LEVEL -CFLAGS += -O$(OPTIMIZATION_LEVEL) -endif +# to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk +CFLAGS += $(OPTIMIZATION_FLAGS) # MCU Series is defined by the HAL package and doesn't need to be specified here C_DEFS = -D$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(MCU_VARIANT) |
