diff options
| author | root <siehputz@gmail.com> | 2020-07-21 10:11:08 -0500 |
|---|---|---|
| committer | root <siehputz@gmail.com> | 2020-07-21 10:11:08 -0500 |
| commit | 49decf90c940f2e9810abcf40939db33a5803ab0 (patch) | |
| tree | 51c2a1641376ce3f6f79899a6a22b19fc5beab61 | |
| parent | ac5ad030f46937781a1e0377cfee29ad184f98ea (diff) | |
Add option for higher optimization levels
| -rw-r--r-- | ports/atmel-samd/Makefile | 5 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk | 2 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/pybadge/mpconfigboard.mk | 2 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/pyportal/mpconfigboard.mk | 2 | ||||
| -rw-r--r-- | ports/cxd56/Makefile | 5 | ||||
| -rw-r--r-- | ports/esp32s2/Makefile | 4 | ||||
| -rw-r--r-- | ports/litex/Makefile | 4 | ||||
| -rw-r--r-- | ports/mimxrt10xx/Makefile | 4 | ||||
| -rwxr-xr-x | ports/nrf/Makefile | 3 | ||||
| -rwxr-xr-x | ports/stm/Makefile | 4 |
10 files changed, 35 insertions, 0 deletions
diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index eedcc94a9..9fa43af21 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -106,6 +106,11 @@ CFLAGS += -Os -DNDEBUG 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 +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif + + $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY)) #Debugging/Optimization ifeq ($(DEBUG), 1) diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk index eb02d3c27..d32dcf3d1 100644 --- a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk @@ -15,3 +15,5 @@ LONGINT_IMPL = MPZ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANG_APA102 = 1 + +OPTIMIZATION_LEVEL = 2 diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk index 7a213faf4..e898d0dda 100644 --- a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk @@ -16,3 +16,5 @@ 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 149141a4e..8a197fbf0 100644 --- a/ports/atmel-samd/boards/pyportal/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pyportal/mpconfigboard.mk @@ -10,3 +10,5 @@ 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 3766d4222..6838270a6 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -123,6 +123,11 @@ CFLAGS += \ -fdata-sections \ -Wall \ +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif + + LIBM = "${shell "$(CC)" $(CFLAGS) -print-file-name=libm.a}" LIBGCC = "${shell "$(CC)" $(CFLAGS) -print-libgcc-file-name}" diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 29abcab8e..ec6a8fc0c 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -109,6 +109,10 @@ else ### CFLAGS += -flto endif +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif + CFLAGS += $(INC) -Werror -Wall -mlongcalls -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 29149942c..7ddf3c061 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -83,6 +83,10 @@ else ### CFLAGS += -flto endif +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif + CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) # TODO: check this diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index d82b625e7..2201d92a3 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -108,6 +108,10 @@ CFLAGS += \ -Os -g3 -Wno-unused-parameter \ -ffunction-sections -fdata-sections -fstack-usage +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif + LD_FILES = $(wildcard boards/$(BOARD)/*.ld) $(addprefix linking/, flash/$(FLASH).ld chip_family/$(CHIP_FAMILY).ld common.ld) LD_SCRIPT_FLAG := -Wl,-T, diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index e1d86f7bc..28fd44b85 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -92,6 +92,9 @@ else CFLAGS += -flto -flto-partition=none endif +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) diff --git a/ports/stm/Makefile b/ports/stm/Makefile index e2dc2346e..8753bd8f8 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -91,6 +91,10 @@ else # CFLAGS += -flto endif +ifdef OPTIMIZATION_LEVEL +CFLAGS += -O$(OPTIMIZATION_LEVEL) +endif + # 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) |
