diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-07-21 13:38:52 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-21 13:38:52 -0700 |
| commit | cb7df2e1ed7c9866b43994e4013497702d8da727 (patch) | |
| tree | a93156e392cf1edcf738c48d6b429e6088aebb4a | |
| parent | e047ea287f6658f1a1fd10ab31f45f25bce846c1 (diff) | |
| parent | 5e3a853db4ad735e3ae1c115cab3ef213a338f0d (diff) | |
Merge pull request #3160 from tannewt/enable_pystack
Enable PYSTACK to keep function state out of the heap
| -rwxr-xr-x | main.c | 8 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/uchip/mpconfigboard.mk | 8 | ||||
| -rw-r--r-- | py/circuitpy_mpconfig.h | 5 |
3 files changed, 16 insertions, 5 deletions
@@ -97,6 +97,10 @@ void do_str(const char *src, mp_parse_input_kind_t input_kind) { } } +#if MICROPY_ENABLE_PYSTACK +static size_t PLACE_IN_DTCM_BSS(_pystack[CIRCUITPY_PYSTACK_SIZE / sizeof(size_t)]); +#endif + void start_mp(supervisor_allocation* heap) { reset_status_led(); autoreload_stop(); @@ -125,6 +129,10 @@ void start_mp(supervisor_allocation* heap) { // Clear the readline history. It references the heap we're about to destroy. readline_init0(); + #if MICROPY_ENABLE_PYSTACK + mp_pystack_init(_pystack, _pystack + (sizeof(_pystack) / sizeof(size_t))); + #endif + #if MICROPY_ENABLE_GC gc_init(heap->ptr, heap->ptr + heap->length / 4); #endif diff --git a/ports/atmel-samd/boards/uchip/mpconfigboard.mk b/ports/atmel-samd/boards/uchip/mpconfigboard.mk index 196068a1e..d08690a15 100644 --- a/ports/atmel-samd/boards/uchip/mpconfigboard.mk +++ b/ports/atmel-samd/boards/uchip/mpconfigboard.mk @@ -10,9 +10,7 @@ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 -# Tweak inlining depending on language. -ifeq ($(TRANSLATION), zh_Latn_pinyin) +# Always use aggressive inlining CFLAGS_INLINE_LIMIT = 45 -else -CFLAGS_INLINE_LIMIT = 70 -endif + +SUPEROPT_GC = 0 diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index d05a246fc..a7853fabd 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -119,6 +119,7 @@ #define MICROPY_QSTR_BYTES_IN_HASH (1) #define MICROPY_REPL_AUTO_INDENT (1) #define MICROPY_REPL_EVENT_DRIVEN (0) +#define MICROPY_ENABLE_PYSTACK (1) #define MICROPY_STACK_CHECK (1) #define MICROPY_STREAMS_NON_BLOCK (1) #ifndef MICROPY_USE_INTERNAL_PRINTF @@ -785,6 +786,10 @@ void supervisor_run_background_tasks_if_tick(void); #define CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS 1000 #endif +#ifndef CIRCUITPY_PYSTACK_SIZE +#define CIRCUITPY_PYSTACK_SIZE 1024 +#endif + #define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt" #define CIRCUITPY_VERBOSE_BLE 0 |
