diff --git a/zephcore/boards/common/esp32_common.conf b/zephcore/boards/common/esp32_common.conf index 61a6e91..79dbc29 100644 --- a/zephcore/boards/common/esp32_common.conf +++ b/zephcore/boards/common/esp32_common.conf @@ -75,10 +75,10 @@ CONFIG_BT_PRIVACY=y # (CONFIG_ZEPHCORE_MEM_STATS, devdocs/tools/mem_load.py: fresh pairing, bonded # reconnects, protocol golden over BLE and TCP, bulk contact dump), peak 724 B, # so 2048 (2.8x). Was 4096. -# The controller task is not trimmable here: on S3/C3 the HAL hardcodes its -# stack to 4096 (components/bt/controller/esp32c3/bt.c) and -# ESP32_BT_CONTROLLER_STACK_SIZE is only a lower-bound check; on classic ESP32 -# it is the real size but that controller (BTDM) was not measured. +# The controller task (ESP32_BT_CONTROLLER_STACK_SIZE, default 4096) is not set +# here: classic ESP32 (BTDM) and the C6 controller were not measured and keep +# the default. S3 and C3 trim it in esp32c3s3_common.conf, where the symbol +# became the real stack size with hal_espressif b16851b3c2 (2026-10-06). CONFIG_BT_TX_PROCESSOR_STACK_SIZE=2048 CONFIG_BT_RX_STACK_SIZE=4096 diff --git a/zephcore/boards/common/esp32c3s3_common.conf b/zephcore/boards/common/esp32c3s3_common.conf index 5f93e9b..a685656 100644 --- a/zephcore/boards/common/esp32c3s3_common.conf +++ b/zephcore/boards/common/esp32c3s3_common.conf @@ -27,3 +27,21 @@ # Repeater builds do not use this value: wifi_ota.conf, appended later, sets # the heap back to 64 KB for the WiFi driver. CONFIG_HEAP_MEM_POOL_SIZE=45056 + +# ========== BLE controller task stack ========== +# Default 4096 (drivers/bluetooth/hci/Kconfig.esp32). Since hal_espressif +# b16851b3c2 (Zephyr pin 74b7173e9c9, 2026-10-06) this symbol is the real size +# of the controller task's stack on these chips; before that +# components/bt/controller/esp32c3/bt.c hardcoded 4096 and the symbol was only +# a lower-bound check. The same symbol is the size the controller is +# configured with (esp_bt.h, .controller_task_stack_size), and the HAL refuses +# to start BT if the controller asks for more than the buffer. +# +# Measured on a XIAO ESP32-S3 companion (2026-10-06, CONFIG_ZEPHCORE_MEM_STATS, +# devdocs/tools/mem_load.py: fresh pairing, bonded reconnects, protocol golden +# over BLE, 8 KB sign, 121-contact dump over BLE): peak 980 B at 4096, and +# 964 B in the same run with the stack at 2048. 2048 is 2.1x the peak and +# returns 2 KB of dram0, which the no-PSRAM Wi-Fi + BLE companions (Heltec V3, +# Wireless Tracker) need. Not measured with a Wi-Fi station link up +# (coexistence), and not measured on C3 hardware. +CONFIG_ESP32_BT_CONTROLLER_STACK_SIZE=2048