From eb44b2bb26ba4578ca97e459c9baa69d549c40a5 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 20 Nov 2019 09:38:17 -0600 Subject: [PATCH 1/6] build.yml: Use a newer build toolchain .. the new version is not offered in .deb form, so the installation process also changes --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d5793573f..e34a2e10c9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -168,7 +168,8 @@ jobs: run: | sudo apt-get install -y gettext pip install requests sh click setuptools awscli - wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~xenial1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb + wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 + sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 - name: Versions run: | gcc --version From 2e4a6b94e71edd3c27cb66eaa56aec9b1e42be33 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 21 Nov 2019 09:57:20 -0600 Subject: [PATCH 2/6] atmel-samd: get most constrained m0 builds to work again By tweaking the optimizer flags, we can get back a few hundred bytes and allow these builds to work with the gcc9 compiler. --- ports/atmel-samd/Makefile | 5 +++++ ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/pyruler/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk | 2 ++ 4 files changed, 11 insertions(+) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 11e6874edd..f26d1f53ec 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -122,7 +122,12 @@ else ifdef CFLAGS_INLINE_LIMIT CFLAGS += -finline-limit=$(CFLAGS_INLINE_LIMIT) endif + CFLAGS += -flto -flto-partition=none + + ifdef CFLAGS_BOARD + CFLAGS += $(CFLAGS_BOARD) + endif endif CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) diff --git a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk index 686c9099fc..fe48db1411 100644 --- a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk @@ -29,3 +29,5 @@ SUPEROPT_GC = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_IRRemote + +CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=20 diff --git a/ports/atmel-samd/boards/pyruler/mpconfigboard.mk b/ports/atmel-samd/boards/pyruler/mpconfigboard.mk index 9663944a38..2fbc178afd 100644 --- a/ports/atmel-samd/boards/pyruler/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pyruler/mpconfigboard.mk @@ -12,3 +12,5 @@ LONGINT_IMPL = NONE CIRCUITPY_SMALL_BUILD = 1 SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=20 diff --git a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk index b4a00b654a..7cbfc36305 100644 --- a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk @@ -12,3 +12,5 @@ LONGINT_IMPL = NONE CIRCUITPY_SMALL_BUILD = 1 SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=20 From 3ed6de7bafb3e128a77af749492a1267fb208f3a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 21 Nov 2019 09:57:20 -0600 Subject: [PATCH 3/6] atmel-samd: reduce inlining on pyruler again By tweaking the optimizer flags further, this build also fits --- ports/atmel-samd/boards/pyruler/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/pyruler/mpconfigboard.mk b/ports/atmel-samd/boards/pyruler/mpconfigboard.mk index 2fbc178afd..44537cea76 100644 --- a/ports/atmel-samd/boards/pyruler/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pyruler/mpconfigboard.mk @@ -13,4 +13,4 @@ CIRCUITPY_SMALL_BUILD = 1 SUPEROPT_GC = 0 -CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=20 +CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=15 From 82f55dc046ace450a518ed3700cffa72e1183c4f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 22 Nov 2019 14:27:44 -0600 Subject: [PATCH 4/6] atmel-samd: reduce inlining on constrained boards again pewpew10, pirkey_m0, and uchip all fit now. However, pirkey_m0 now has just 76 bytes flash available. --- ports/atmel-samd/boards/pewpew10/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk | 2 +- ports/atmel-samd/boards/uchip/mpconfigboard.mk | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk index e24a290519..f9094db913 100644 --- a/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk @@ -23,3 +23,5 @@ CIRCUITPY_USB_MIDI = 0 SUPEROPT_GC = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/pew-pewpew-standalone-10.x + +CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=15 diff --git a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk index fe48db1411..18a1ad8686 100644 --- a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk @@ -30,4 +30,4 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_IRRemote -CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=20 +CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=12 diff --git a/ports/atmel-samd/boards/uchip/mpconfigboard.mk b/ports/atmel-samd/boards/uchip/mpconfigboard.mk index 109492b764..3967b76ee9 100644 --- a/ports/atmel-samd/boards/uchip/mpconfigboard.mk +++ b/ports/atmel-samd/boards/uchip/mpconfigboard.mk @@ -10,3 +10,5 @@ CHIP_FAMILY = samd21 INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_SMALL_BUILD = 1 + +CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=20 From d843156a5e2018a8dd763dbcce325e62cca38cc2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 29 Nov 2019 10:51:16 -0600 Subject: [PATCH 5/6] samd: Consolidate small build optimization flags .. inline-unit-growth was the same across all boards, and the highest max-inline-insns-auto parameter was shared across 2 of 5 boards, so it's worth a little work to follow the DRY principle --- ports/atmel-samd/Makefile | 4 ++++ ports/atmel-samd/boards/pewpew10/mpconfigboard.mk | 2 +- ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk | 2 +- ports/atmel-samd/boards/pyruler/mpconfigboard.mk | 2 +- ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk | 2 -- ports/atmel-samd/boards/uchip/mpconfigboard.mk | 2 -- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index f26d1f53ec..5d47fd0871 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -125,6 +125,10 @@ else CFLAGS += -flto -flto-partition=none + ifeq ($(CIRCUITPY_SMALL_BUILD),1) + CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20 + endif + ifdef CFLAGS_BOARD CFLAGS += $(CFLAGS_BOARD) endif diff --git a/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk index f9094db913..8a1d6b16a4 100644 --- a/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk @@ -24,4 +24,4 @@ SUPEROPT_GC = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/pew-pewpew-standalone-10.x -CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=15 +CFLAGS_BOARD = --param max-inline-insns-auto=15 diff --git a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk index 18a1ad8686..12d6ace0c8 100644 --- a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk @@ -30,4 +30,4 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_IRRemote -CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=12 +CFLAGS_BOARD = --param max-inline-insns-auto=12 diff --git a/ports/atmel-samd/boards/pyruler/mpconfigboard.mk b/ports/atmel-samd/boards/pyruler/mpconfigboard.mk index 44537cea76..72893be8da 100644 --- a/ports/atmel-samd/boards/pyruler/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pyruler/mpconfigboard.mk @@ -13,4 +13,4 @@ CIRCUITPY_SMALL_BUILD = 1 SUPEROPT_GC = 0 -CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=15 +CFLAGS_BOARD = --param max-inline-insns-auto=15 diff --git a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk index 7cbfc36305..b4a00b654a 100644 --- a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk @@ -12,5 +12,3 @@ LONGINT_IMPL = NONE CIRCUITPY_SMALL_BUILD = 1 SUPEROPT_GC = 0 - -CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=20 diff --git a/ports/atmel-samd/boards/uchip/mpconfigboard.mk b/ports/atmel-samd/boards/uchip/mpconfigboard.mk index 3967b76ee9..109492b764 100644 --- a/ports/atmel-samd/boards/uchip/mpconfigboard.mk +++ b/ports/atmel-samd/boards/uchip/mpconfigboard.mk @@ -10,5 +10,3 @@ CHIP_FAMILY = samd21 INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_SMALL_BUILD = 1 - -CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=20 From 002f5c0f1cb0f44a471dac0fafcc7850521a246f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 2 Dec 2019 08:25:48 -0600 Subject: [PATCH 6/6] samd: trinket_m0: make board fit again --- ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk index b4a00b654a..af8b561a21 100644 --- a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk @@ -12,3 +12,9 @@ LONGINT_IMPL = NONE CIRCUITPY_SMALL_BUILD = 1 SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), zh_Latn_pinyin) +CFLAGS_INLINE_LIMIT = 35 +endif +