summaryrefslogtreecommitdiff
path: root/extmod/modbluetooth.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-02-15 23:03:29 +1100
committerDamien George <damien@micropython.org>2024-02-16 10:19:26 +1100
commitcd66aa05cf2d11401876a342fad2425e766bd921 (patch)
tree6c719a98bef539645c812a5b0f303942a230a96e /extmod/modbluetooth.c
parent809d113dbc37a032e87accc95c140f189733e0c4 (diff)
esp32: Increase NimBLE task stack size and overflow detection headroom.
The Python BLE IRQ handler will most likely run on the NimBLE task, so its C stack must be large enough to accommodate reasonably complicated Python code (eg a few call depths). So increase this stack size. Also increase the headroom from 1024 to 2048 bytes. This is needed because (1) the esp32 architecture uses a fair amount of stack in general; and (2) by the time execution gets to setting the Python stack top via `mp_stack_set_top()` in this interlock code, about 600 bytes of stack are already used, which reduces the amount available for Python. Fixes issue #12349. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/modbluetooth.c')
-rw-r--r--extmod/modbluetooth.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/extmod/modbluetooth.c b/extmod/modbluetooth.c
index cef5151cc..32a15bf51 100644
--- a/extmod/modbluetooth.c
+++ b/extmod/modbluetooth.c
@@ -1274,7 +1274,7 @@ STATIC mp_obj_t invoke_irq_handler(uint16_t event,
if (ts_orig == NULL) {
mp_thread_set_state(&ts);
mp_stack_set_top(&ts + 1); // need to include ts in root-pointer scan
- mp_stack_set_limit(MICROPY_PY_BLUETOOTH_SYNC_EVENT_STACK_SIZE - 1024);
+ mp_stack_set_limit(MICROPY_PY_BLUETOOTH_SYNC_EVENT_STACK_SIZE);
ts.gc_lock_depth = 0;
ts.nlr_jump_callback_top = NULL;
ts.mp_pending_exception = MP_OBJ_NULL;