# ESP32-S3 and ESP32-C3 only. Loaded after esp32_common.conf and before # board.conf (CMakeLists.txt, matched on the /esp32s3/ qualifier or an esp32c3 # board name). The two chips share one BLE controller: the S3 build compiles # hal_espressif's components/bt/controller/esp32c3 sources and links the same # btdm controller library family, so one heap figure covers both. The C6 runs # a different controller and keeps esp32_common.conf's 64 KB. # # ========== System heap ========== # esp32_common.conf sizes the heap at 64 KB for the Espressif BLE controller, # which allocates through k_malloc (CONFIG_ESP_BT_HEAP_SYSTEM=y). On Zephyr 4.5 # that no longer fits the shared IRAM/DRAM SRAM of these chips: the new # hal_espressif controller blob places ~15-19 KB of link-layer patch code # (r_lld_*_hack / *_eco) in IRAM, and dram0 shrinks by the same amount. On the # S3, Heltec V4/V43, Wireless Tracker V2 and Meshnology W12 overflowed in the # sysbuild (MCUboot) layout; the XIAO ESP32-C3 companion went from 92.83% to # 99.02% dram0. # # Measured on a XIAO ESP32-S3 companion (2026-09-19, Zephyr main 3e8f38faf93, # CONFIG_SYS_HEAP_RUNTIME_STATS): 26.8 KB allocated after BLE init, peak # 28.8 KB across boot, pairing, contact/channel sync and a live session. # 44 KB leaves ~16 KB above that for boards that allocate more before # bt_enable() -- the ThinkNode M9 (display, keypad, LR1110) is the reason the # pool was once raised from 32 KB (see esp32_common.conf). Applied to the C3 # 2026-09-19 on the strength of the shared controller; not yet measured on C3 # hardware (`get mem` with CONFIG_ZEPHCORE_MEM_STATS=y is the check). # # 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. With a Wi-Fi station link up # (TCP companion, 8 parallel 1400-byte pings, BLE sessions with contact dumps) # the peak is 1108 B, the same on 7 boots out of 7. 2048 is 1.85x that and # returns 2 KB of dram0, which the no-PSRAM Wi-Fi + BLE companions (Heltec V3, # Wireless Tracker) need. Not measured on C3 hardware. CONFIG_ESP32_BT_CONTROLLER_STACK_SIZE=2048