From c4fb9c0638ce43100ee150757945e690a4a5eb29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Fesser?= Date: Mon, 6 Jul 2026 19:26:17 +0200 Subject: [PATCH] Fix TX wait thread stack overflow on Xtensa (boot freeze) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TX_WAIT_THREAD_STACK_SIZE was 1024 bytes, shared by every radio adapter. On Xtensa (all ESP32/S3 boards) the windowed ABI needs ~3x the stack of Cortex-M for the same code — Zephyr's own Kconfig defaults reflect this (IDLE_STACK_SIZE: 1024 if XTENSA vs 320 ARM). Measured peak usage on Heltec V4 (immediate-mode logging, full TX cycle including startReceive/lora_config): 1252 bytes — already past the old 1024 limit. The overflow corrupts the exception frame and parks CPU0 in _DoubleExceptionVector (LoadProhibited @0x2c), a silent total freeze at boot. Confirmed via the S3 built-in USB-JTAG: current thread at crash = lora_tx_wait. 2048 gives ~39% headroom over the measured worst case. --- zephcore/adapters/radio/radio_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zephcore/adapters/radio/radio_common.h b/zephcore/adapters/radio/radio_common.h index fa04cc0..5b02489 100644 --- a/zephcore/adapters/radio/radio_common.h +++ b/zephcore/adapters/radio/radio_common.h @@ -24,7 +24,7 @@ #define RX_RING_SIZE 8 /* ~2 KB; buffers burst arrivals at SF7/BW500 */ /* --- TX wait thread --- */ -#define TX_WAIT_THREAD_STACK_SIZE 1024 +#define TX_WAIT_THREAD_STACK_SIZE 2048 #define TX_WAIT_THREAD_PRIORITY 10 /* preemptible, below main thread */ #define TX_TIMEOUT_MS 5000 /* hard timeout for TX completion signal */