summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2024-08-06 15:52:54 +1000
committerDamien George <damien@micropython.org>2024-08-14 12:57:23 +1000
commitfbc19596f052016dee10a6af56441f4fb532243c (patch)
tree7e1a5051edd67b49a56903d9e931d2cead97146b
parent80616aee71afedc3c7bfb013d87d8102981aa6b2 (diff)
rp2: Switch to use new cstack API for stack limit checks.
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
-rw-r--r--ports/rp2/main.c5
-rw-r--r--ports/rp2/mpconfigport.h1
2 files changed, 3 insertions, 3 deletions
diff --git a/ports/rp2/main.c b/ports/rp2/main.c
index 0f2721f17..1ce1d2bf3 100644
--- a/ports/rp2/main.c
+++ b/ports/rp2/main.c
@@ -27,11 +27,11 @@
#include <stdio.h>
#include "py/compile.h"
+#include "py/cstack.h"
#include "py/runtime.h"
#include "py/gc.h"
#include "py/mperrno.h"
#include "py/mphal.h"
-#include "py/stackctrl.h"
#include "extmod/modbluetooth.h"
#include "extmod/modnetwork.h"
#include "shared/readline/readline.h"
@@ -114,8 +114,7 @@ int main(int argc, char **argv) {
mp_hal_time_ns_set_from_rtc();
// Initialise stack extents and GC heap.
- mp_stack_set_top(&__StackTop);
- mp_stack_set_limit(&__StackTop - &__StackBottom - 256);
+ mp_cstack_init_with_top(&__StackTop, &__StackTop - &__StackBottom);
gc_init(&__GcHeapStart, &__GcHeapEnd);
#if MICROPY_PY_LWIP
diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h
index 6ef994bb8..3399212aa 100644
--- a/ports/rp2/mpconfigport.h
+++ b/ports/rp2/mpconfigport.h
@@ -81,6 +81,7 @@
#define MICROPY_TRACKED_ALLOC (MICROPY_SSL_MBEDTLS || MICROPY_BLUETOOTH_BTSTACK)
#define MICROPY_READER_VFS (1)
#define MICROPY_ENABLE_GC (1)
+#define MICROPY_STACK_CHECK_MARGIN (256)
#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)