From 7316c742cf7f2854728f7a7e855d42885e47db56 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sun, 12 Sep 2021 18:04:02 +0530 Subject: [PATCH 1/4] make `next_code_allocation` and `prev_traceback_allocation` movable --- main.c | 2 +- shared-bindings/supervisor/__init__.c | 2 +- supervisor/shared/memory.c | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index d024717beb..d6ed269809 100755 --- a/main.c +++ b/main.c @@ -236,7 +236,7 @@ STATIC void cleanup_after_vm(supervisor_allocation* heap, mp_obj_t exception) { size_t traceback_len = 0; mp_print_t print_count = {&traceback_len, count_strn}; mp_obj_print_exception(&print_count, exception); - prev_traceback_allocation = allocate_memory(align32_size(traceback_len + 1), false, false); + prev_traceback_allocation = allocate_memory(align32_size(traceback_len + 1), false, true); // Empirically, this never fails in practice - even when the heap is totally filled up // with single-block-sized objects referenced by a root pointer, exiting the VM frees // up several hundred bytes, sufficient for the traceback (which tends to be shortened diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index 8c581c9364..a9b99ed87d 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -195,7 +195,7 @@ STATIC mp_obj_t supervisor_set_next_code_file(size_t n_args, const mp_obj_t *pos const char *filename = mp_obj_str_get_data(args.filename.u_obj, &len); free_memory(next_code_allocation); if (options != 0 || len != 0) { - next_code_allocation = allocate_memory(align32_size(sizeof(next_code_info_t) + len + 1), false, false); + next_code_allocation = allocate_memory(align32_size(sizeof(next_code_info_t) + len + 1), false, true); if (next_code_allocation == NULL) { m_malloc_fail(sizeof(next_code_info_t) + len + 1); } diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index 04f2f571db..cf7dbf7ed7 100644 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -34,12 +34,9 @@ enum { CIRCUITPY_SUPERVISOR_IMMOVABLE_ALLOC_COUNT = + 0 // stack + heap - 2 - // next_code_allocation - + 1 - // prev_traceback_allocation - + 1 + + 2 #if INTERNAL_FLASH_FILESYSTEM == 0 + 1 @@ -59,6 +56,10 @@ enum { CIRCUITPY_SUPERVISOR_MOVABLE_ALLOC_COUNT = 0 + // next_code_allocation + + 1 + // prev_traceback_allocation + + 1 #if CIRCUITPY_DISPLAYIO #if CIRCUITPY_TERMINALIO + 1 From 94d76e0f480136db8ae9ca12298c7b79c58995e9 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 14 Sep 2021 12:10:16 -0400 Subject: [PATCH 2/4] turn off inline-unit-growth and max-inline-insns-auto uses --- ports/atmel-samd/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 810d86581b..4eead04b07 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -150,7 +150,8 @@ else CFLAGS += -flto -flto-partition=none ifeq ($(CIRCUITPY_FULL_BUILD),0) - CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20 + # This is making the build larger in some cases (gcc 10.2.1), so turn it off for now + # CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20 endif ifdef CFLAGS_BOARD From 81e28308c2c2285a41c945ffaf52d9952f40552a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 14 Sep 2021 16:56:04 -0400 Subject: [PATCH 3/4] Revert "turn off inline-unit-growth and max-inline-insns-auto uses" This reverts commit 94d76e0f480136db8ae9ca12298c7b79c58995e9. --- ports/atmel-samd/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 4eead04b07..810d86581b 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -150,8 +150,7 @@ else CFLAGS += -flto -flto-partition=none ifeq ($(CIRCUITPY_FULL_BUILD),0) - # This is making the build larger in some cases (gcc 10.2.1), so turn it off for now - # CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20 + CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20 endif ifdef CFLAGS_BOARD From 0ab4df6f2f04e0a9da2bf357de73db4b6bb38038 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 14 Sep 2021 17:10:49 -0400 Subject: [PATCH 4/4] shrink some SAMD21 builds, and nrf simmel --- ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk | 3 ++- ports/nrf/boards/simmel/mpconfigboard.mk | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk index c3d75202bf..abbdbe87ef 100644 --- a/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk +++ b/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk @@ -9,3 +9,5 @@ CHIP_FAMILY = samd21 INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 + +CIRCUITPY_RAINBOWIO = 0 diff --git a/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk index 895c027ee5..a61e321b29 100644 --- a/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk +++ b/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk @@ -9,3 +9,5 @@ CHIP_FAMILY = samd21 INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 + +CIRCUITPY_RAINBOWIO = 0 diff --git a/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk index 5ee22c59ad..58fd9ca6e4 100644 --- a/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk +++ b/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk @@ -9,3 +9,5 @@ CHIP_FAMILY = samd21 INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 + +CIRCUITPY_RAINBOWIO = 0 diff --git a/ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk b/ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk index 4687ce32a0..f59483a608 100644 --- a/ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk @@ -11,5 +11,6 @@ LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 # There are many pin definitions on this board; it doesn't quite fit on very large translations. -# So remove what might be least likely module to be used. +# Remove a couple of modules. +CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_RAINBOWIO = 0 diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index 4f6385260e..82fc68a235 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -20,6 +20,7 @@ CIRCUITPY_COUNTIO = 0 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_ERRNO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 +CIRCUITPY_GETPASS = 0 CIRCUITPY_KEYPAD = 0 CIRCUITPY_MSGPACK = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 @@ -27,6 +28,7 @@ CIRCUITPY_NVM = 0 CIRCUITPY_PIXELBUF = 0 CIRCUITPY_PULSEIO = 0 CIRCUITPY_PWMIO = 1 +CIRCUITPY_RAINBOWIO = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 1