diff options
author | Andrew Leech <andrew.leech@planetinnovation.com.au> | 2025-03-26 10:23:55 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-04-22 11:29:48 +1000 |
commit | d6c673f28f12978625577a4d1214ebf450d57c8d (patch) | |
tree | d9004d97ee45802f45b1dcb487a643869ed410ab | |
parent | 569d472bc7f6f6fb20f69fcdb3ff19f525dec071 (diff) | |
download | micropython-d6c673f28f12978625577a4d1214ebf450d57c8d.tar.gz micropython-d6c673f28f12978625577a4d1214ebf450d57c8d.zip |
stm32/main: Replace mp_stack_set calls with new mp_cstack_init_with_top.
Required in MICROPY_PREVIEW_VERSION_2.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
-rw-r--r-- | ports/stm32/main.c | 7 | ||||
-rw-r--r-- | ports/stm32/mpconfigport.h | 1 |
2 files changed, 3 insertions, 5 deletions
diff --git a/ports/stm32/main.c b/ports/stm32/main.c index 0f904a8ba9..e8395013b9 100644 --- a/ports/stm32/main.c +++ b/ports/stm32/main.c @@ -515,11 +515,8 @@ soft_reset: mp_thread_init(); #endif - // Stack limit should be less than real stack size, so we have a chance - // to recover from limit hit. (Limit is measured in bytes.) - // Note: stack control relies on main thread being initialised above - mp_stack_set_top(&_estack); - mp_stack_set_limit((char *)&_estack - (char *)&_sstack - 1024); + // Stack limit init. + mp_cstack_init_with_top(&_estack, (char *)&_estack - (char *)&_sstack); // GC init gc_init(MICROPY_HEAP_START, MICROPY_HEAP_END); diff --git a/ports/stm32/mpconfigport.h b/ports/stm32/mpconfigport.h index da86fa6416..d1d6fe249b 100644 --- a/ports/stm32/mpconfigport.h +++ b/ports/stm32/mpconfigport.h @@ -43,6 +43,7 @@ #define MICROPY_GC_STACK_ENTRY_TYPE uint16_t #endif #endif +#define MICROPY_STACK_CHECK_MARGIN (1024) #define MICROPY_ALLOC_PATH_MAX (128) // optimisations |