From 009abf4932f7940939526ca3412a3d908394516f Mon Sep 17 00:00:00 2001 From: Matt Hillsdon <44397098+microbit-matt-hillsdon@users.noreply.github.com> Date: Tue, 26 Sep 2023 16:48:19 +0100 Subject: [PATCH] Increase asyncify stack size (#106) Pick the first power of two where we fail with a pystack exhausted error in MicroPython rather than an asyncify-related error. Add an example to the demo that finds the max stack size. --- src/Makefile | 2 ++ src/demo.html | 1 + src/examples/stack_size.py | 10 ++++++++++ 3 files changed, 13 insertions(+) create mode 100644 src/examples/stack_size.py diff --git a/src/Makefile b/src/Makefile index a9f0512a..66dbdcba 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,6 +44,8 @@ COPT += -O3 -DNDEBUG endif JSFLAGS += -s ASYNCIFY +# We can hit lower values due to user stack use. See stack_size.py example. +JSFLAGS += -s ASYNCIFY_STACK_SIZE=262144 JSFLAGS += -s EXIT_RUNTIME JSFLAGS += -s MODULARIZE=1 JSFLAGS += -s EXPORT_NAME=createModule diff --git a/src/demo.html b/src/demo.html index 5889f7cf..83dabe83 100644 --- a/src/demo.html +++ b/src/demo.html @@ -100,6 +100,7 @@

MicroPython-micro:bit simulator example embedding

+