From 641ab0dc0679b0a6fd0568641db746fb0cf6d3fc Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 8 Apr 2025 12:31:24 -0400 Subject: [PATCH] increase default PYSTACK size from 1536 to 2048 --- ports/atmel-samd/mpconfigport.h | 5 +++++ ports/nordic/boards/TG-Watch/mpconfigboard.h | 2 +- py/circuitpy_mpconfig.h | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index eca28dbd9be0..3eafe0acfa7d 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -100,6 +100,11 @@ #define CIRCUITPY_DEFAULT_STACK_SIZE 3584 #endif +#ifndef CIRCUITPY_PYSTACK_SIZE +// Default for most boards is 2048 starting with CircuitPython 10, but on SAMD21, keep it at previous lower value. +#define CIRCUITPY_PYSTACK_SIZE 1536 +#endif + #ifndef SAMD21_BOD33_LEVEL // Set brownout detection to ~2.7V. Default from factory is 1.7V, // which is too low for proper operation of external SPI flash chips diff --git a/ports/nordic/boards/TG-Watch/mpconfigboard.h b/ports/nordic/boards/TG-Watch/mpconfigboard.h index 8ebb88f6f86b..4016b1ea84cf 100644 --- a/ports/nordic/boards/TG-Watch/mpconfigboard.h +++ b/ports/nordic/boards/TG-Watch/mpconfigboard.h @@ -13,7 +13,7 @@ #define MICROPY_HW_MCU_NAME "nRF52840" // TG-Gui requires a deeper call stack than normal CircuitPython, this is intentional overkill -#define CIRCUITPY_PYSTACK_SIZE 8192 // 1536 is the normal size, (32 bytes/frame * 48 frames) +#define CIRCUITPY_PYSTACK_SIZE 8192 // the board has a 32mhz crystal but NOT a 32khz one #define BOARD_HAS_32KHZ_XTAL 0 diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 42e6f1841a44..701b1b0674cf 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -452,7 +452,7 @@ void background_callback_run_all(void); #endif #ifndef CIRCUITPY_PYSTACK_SIZE -#define CIRCUITPY_PYSTACK_SIZE 1536 +#define CIRCUITPY_PYSTACK_SIZE 2048 #endif // The VM heap starts at this size and doubles in size as needed until it runs