summaryrefslogtreecommitdiff
path: root/ports
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2020-12-15 12:23:56 -0500
committerDan Halbert <halbert@halwitz.org>2020-12-15 12:23:56 -0500
commitfb33c4e1c0f83bce8f8cc1e8cae83695aeb2471d (patch)
tree5873d051adb7a74e11b6a15c6f4e20c39a1deeb1 /ports
parentbbbd621b184ee13740c0c8e4c94e7aed0db4f070 (diff)
-ftree-vrp better diagnostics on -Os builds; -fno-inline-functions for -O2; fix struct init in HCI bleio
Diffstat (limited to 'ports')
-rw-r--r--ports/atmel-samd/Makefile9
-rw-r--r--ports/cxd56/Makefile2
-rw-r--r--ports/litex/Makefile2
-rw-r--r--ports/mimxrt10xx/Makefile4
-rwxr-xr-xports/nrf/Makefile2
-rwxr-xr-xports/stm/Makefile5
6 files changed, 15 insertions, 9 deletions
diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile
index c214d56f0..58c1c0d60 100644
--- a/ports/atmel-samd/Makefile
+++ b/ports/atmel-samd/Makefile
@@ -94,21 +94,21 @@ endif
ifeq ($(CHIP_FAMILY), samd51)
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
-OPTIMIZATION_FLAGS ?= -Os
+OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
# 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), same51)
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
-OPTIMIZATION_FLAGS ?= -Os
+OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
# TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -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
-OPTIMIZATION_FLAGS ?= -Os
+OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
# TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -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
@@ -116,6 +116,9 @@ endif
# option to override default optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
+# Add -ftree-vrp optimization and checking to all builds. It's not enabled for -Os by default.
+CFLAGS += -ftree-vrp
+
$(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
#Debugging/Optimization
ifeq ($(DEBUG), 1)
diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile
index 5201f0db5..1c48a23ca 100644
--- a/ports/cxd56/Makefile
+++ b/ports/cxd56/Makefile
@@ -122,7 +122,7 @@ CFLAGS += \
-fdata-sections \
-Wall \
-OPTIMIZATION_FLAGS ?= -O2
+OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
diff --git a/ports/litex/Makefile b/ports/litex/Makefile
index 612953daa..f384f2457 100644
--- a/ports/litex/Makefile
+++ b/ports/litex/Makefile
@@ -80,7 +80,7 @@ ifeq ($(DEBUG), 1)
OPTIMIZATION_FLAGS ?= -Og
else
CFLAGS += -DNDEBUG -ggdb3
- OPTIMIZATION_FLAGS ?= -O2
+ OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
# TODO: Test with -flto
### CFLAGS += -flto
endif
diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile
index a17e5f703..04949bf01 100644
--- a/ports/mimxrt10xx/Makefile
+++ b/ports/mimxrt10xx/Makefile
@@ -75,7 +75,7 @@ INC += \
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
-CFLAGS += -Os -DNDEBUG -ffreestanding
+CFLAGS += -Os -ftree-vrp -DNDEBUG -ffreestanding
# TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_CDC_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=512 -DCFG_TUD_CDC_TX_BUFSIZE=512 -DCFG_TUD_MSC_BUFSIZE=1024
@@ -108,7 +108,7 @@ CFLAGS += \
-g3 -Wno-unused-parameter \
-ffunction-sections -fdata-sections -fstack-usage
-OPTIMIZATION_FLAGS ?= -O2
+OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile
index 3fef68e88..278625e92 100755
--- a/ports/nrf/Makefile
+++ b/ports/nrf/Makefile
@@ -89,7 +89,7 @@ ifeq ($(DEBUG), 1)
CFLAGS += -ggdb3
OPTIMIZATION_FLAGS = -Og
else
- OPTIMIZATION_FLAGS ?= -O2
+ OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
CFLAGS += -DNDEBUG -ggdb3
CFLAGS += -flto -flto-partition=none
endif
diff --git a/ports/stm/Makefile b/ports/stm/Makefile
index b9426e07e..e09fe736c 100755
--- a/ports/stm/Makefile
+++ b/ports/stm/Makefile
@@ -86,7 +86,7 @@ ifeq ($(DEBUG), 1)
CFLAGS += -fno-inline -fno-ipa-sra
else
CFLAGS += -DNDEBUG
- OPTIMIZATION_FLAGS ?= -O2
+ OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
CFLAGS += -ggdb3
# TODO: Test with -flto
# CFLAGS += -flto
@@ -95,6 +95,9 @@ endif
# to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
+# Add -ftree-vrp optimization and checking to all builds. It's not enabled for -Os by default.
+CFLAGS += -ftree-vrp
+
# 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)