From d441788975a6dfb277ad9a3d54d651ae48817d16 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 29 Jul 2025 23:09:49 +1000 Subject: [PATCH] esp8266/main: Use new cstack API and add a stack margin of 64 bytes. The margin of 64 bytes is needed to get `micropython/extreme_exc.py` to pass when run via-mpy. Signed-off-by: Damien George --- ports/esp8266/main.c | 4 +--- ports/esp8266/mpconfigport.h | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ports/esp8266/main.c b/ports/esp8266/main.c index da712fce9b..fb6cda3798 100644 --- a/ports/esp8266/main.c +++ b/ports/esp8266/main.c @@ -31,7 +31,6 @@ #include "py/builtin.h" #include "py/compile.h" #include "py/runtime.h" -#include "py/stackctrl.h" #include "py/mperrno.h" #include "py/mphal.h" #include "py/gc.h" @@ -108,8 +107,7 @@ static void print_reset_info(void) { #endif static void mp_reset(void) { - mp_stack_set_top((void *)0x40000000); - mp_stack_set_limit(8192); + mp_cstack_init_with_top((void *)0x40000000, 8192); mp_hal_init(); gc_init(heap, heap + sizeof(heap)); mp_init(); diff --git a/ports/esp8266/mpconfigport.h b/ports/esp8266/mpconfigport.h index 0321de45d7..17c3ff4417 100644 --- a/ports/esp8266/mpconfigport.h +++ b/ports/esp8266/mpconfigport.h @@ -52,6 +52,7 @@ #define MICROPY_ALLOC_PARSE_CHUNK_INIT (64) #define MICROPY_DEBUG_PRINTER (&mp_debug_print) #define MICROPY_ENABLE_GC (1) +#define MICROPY_STACK_CHECK_MARGIN (64) #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1) #define MICROPY_REPL_EVENT_DRIVEN (0) #define MICROPY_USE_INTERNAL_ERRNO (1)