132 lines
6.1 KiB
Plaintext
132 lines
6.1 KiB
Plaintext
CONFIG_IDF_TARGET="esp32s3"
|
||
|
||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions/partitions.csv"
|
||
|
||
CONFIG_FREERTOS_HZ=1000
|
||
CONFIG_FREERTOS_USE_TRACE_FACILITY=y
|
||
CONFIG_SPIRAM=y
|
||
CONFIG_SPIRAM_MODE_OCT=y
|
||
CONFIG_SPIRAM_SPEED_80M=y
|
||
CONFIG_SPIRAM_USE_MALLOC=y
|
||
# WiFi/lwIP buffers go to PSRAM first, exactly as the previous firmware
|
||
# (its sdkconfig.defaults line 92). Without this they come out of the internal
|
||
# heap, and with the capture stack + hot buffers also internal the device was
|
||
# measured running at free=1511 min=791 bytes — lwIP and TLS starve, the TCP
|
||
# receive window collapses, and the symptom is "no uplink, no TTS, no prompts".
|
||
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
|
||
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
|
||
# TRY_ALLOCATE_WIFI_LWIP silently RAISES the WiFi buffer defaults (static
|
||
# rx 10->16, rx_ba_win 6->16) on the theory that PSRAM absorbs the cost —
|
||
# but static RX/TX buffers are DMA and always come from internal RAM. Left
|
||
# uncapped they ate ~40 KB: internal free fell to 5 KB and the driver could
|
||
# not even malloc auth frames ("wifi:m f auth"), so the device sat in an
|
||
# auth->init retry loop while the credentials were perfectly valid. These
|
||
# caps are the previous firmware's proven pairing for the same flag.
|
||
CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=6
|
||
CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=8
|
||
CONFIG_ESP_WIFI_RX_BA_WIN=8
|
||
# malloc() >= 1 KB prefers PSRAM (IDF default: 16 KB). Mid-size plain-malloc
|
||
# buffers (websocket rx, http client, cJSON) were squatting on internal RAM,
|
||
# which must stay available for DMA-capable allocations — esp-aes bounces
|
||
# every TLS record through an internal DMA buffer and drops the connection
|
||
# when it cannot get one ("esp-aes: Failed to allocate memory").
|
||
#
|
||
# 2026-9-22 从 4096 降到 1024:双击配网时打印的内部堆快照显示
|
||
# 0x3fcdad1c len 59391 free 14571 allocated 43908 / largest_free_block 11264
|
||
# 0x3fce9710 len 22308 free 4 allocated 21204 / largest_free_block ...
|
||
# 两个内部区合计 ~85KB,被 71 个 <4KB 的小分配塞到只剩 4 字节,最大连续块只有
|
||
# 11KB,而 BT 控制器初始化需要一次 30KB 连续内部块(BLE_INIT: Malloc failed)。
|
||
# 阈值降到 1024 后这批小分配改落 PSRAM(还有 ~2.8MB 空闲),内部区得以腾空。
|
||
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=1024
|
||
# 内部专用保留池:只服务于"必须在内部 RAM"的请求(DMA 缓冲、FreeRTOS 任务栈、
|
||
# esp-aes bounce 等),普通 malloc 拿不到它。默认 32KB 已经被开机的几个动态栈
|
||
# 吃掉大半:main 8KB + sys_evt 3KB + esp_timer + lwIP tcpip + ipc ≈ 25KB,剩下
|
||
# 的碎块最大只有 11KB。而 BT 控制器初始化时要一次性要一个 **30KB 连续内部块**
|
||
# (BLE_INIT: Malloc failed → ROM assert emi.c/r_ble_util_buf_rx_alloc param 0x7800),
|
||
# 同一池子也是之前 "wifi:mem fail" / "esp-aes: Failed to allocate memory" 的现场。
|
||
# 因此把池子扩到 64KB:装下 30KB 连续块后仍有余量。
|
||
# 代价:主内部堆相应少 32KB(普通 malloc < 1KB 仍走内部),实测 PSRAM 侧还有
|
||
# ~2.8MB 空闲,普通分配会落到 PSRAM。如果之后出现别的 malloc 失败,先回退到 49152。
|
||
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=65536
|
||
|
||
CONFIG_CODEC_ES8389_SUPPORT=y
|
||
|
||
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
|
||
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
|
||
CONFIG_COMPILER_OPTIMIZATION_PERF=y
|
||
CONFIG_COMPILER_CXX_EXCEPTIONS=n
|
||
CONFIG_COMPILER_CXX_RTTI=n
|
||
|
||
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
|
||
CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y
|
||
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y
|
||
# Carried from the previous firmware: ssl_check_ctr_renegotiate dereferences
|
||
# ssl->session, which can be NULL during connection teardown -> LoadProhibited
|
||
# panic. Renegotiation is unused by our servers; keep it off.
|
||
CONFIG_MBEDTLS_SSL_RENEGOTIATION=n
|
||
CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=4096
|
||
CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096
|
||
CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=n
|
||
CONFIG_MODEL_IN_FLASH=y
|
||
CONFIG_AFE_INTERFACE_V1=y
|
||
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
|
||
|
||
CONFIG_BT_ENABLED=y
|
||
CONFIG_BT_NIMBLE_ENABLED=y
|
||
CONFIG_BT_BLUEDROID_ENABLED=n
|
||
CONFIG_BT_CONTROLLER_ENABLED=y
|
||
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1
|
||
CONFIG_BT_CTRL_BLE_MAX_ACT=2
|
||
CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU=517
|
||
CONFIG_BT_NIMBLE_ROLE_CENTRAL=n
|
||
CONFIG_BT_NIMBLE_ROLE_OBSERVER=y
|
||
CONFIG_BT_NIMBLE_GATT_CLIENT=n
|
||
# NimBLE HOST pools (msys mbufs, HCI evt/cmd/ACL buffers) go to PSRAM. The
|
||
# host is pure software and never touches DMA; only the controller needs
|
||
# internal RAM (bt_osi_mem_*_internal, unaffected by this switch). With the
|
||
# host pools internal, provisioning-mode BLE died at esp_nimble_init: after
|
||
# the controller claimed its share the fragmented internal heap (free 63KB,
|
||
# largest block 24.5KB) could not fit them -> "BLE_INIT: hci inits failed".
|
||
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL=y
|
||
|
||
CONFIG_LWIP_PPP_SUPPORT=y
|
||
CONFIG_LWIP_PPP_ENABLE_IPV4=y
|
||
CONFIG_LWIP_PPP_ENABLE_IPV6=n
|
||
CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y
|
||
CONFIG_LWIP_PPP_PAP_SUPPORT=y
|
||
CONFIG_LWIP_PPP_CHAP_SUPPORT=y
|
||
CONFIG_UART_ISR_IN_IRAM=y
|
||
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
|
||
|
||
# sys_evt ran at 292 bytes of stack headroom (diagnostics LOW warning, IDF
|
||
# default 2304). One deep WiFi/IP event callback away from a corrupting
|
||
# overflow; +768 bytes of internal RAM buys the margin.
|
||
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072
|
||
|
||
# Debug-phase only: stream mic+speaker PCM to tools/audio_tap_dump.py for
|
||
# boot-to-shutdown WAV capture. An open microphone on the LAN — flip to n
|
||
# before any release build.
|
||
CONFIG_BORLA_AUDIO_TAP=n
|
||
|
||
# ML307 cellular: China Mobile APN; dial must use full 3GPP form with explicit
|
||
# PDP context id — ATD*99# gets immediate ERROR (ML307A rejects implicit dial).
|
||
CONFIG_BORLA_ML307_APN="cmiot"
|
||
CONFIG_BORLA_ML307_DIAL_COMMAND="ATD*99***1#"
|
||
|
||
CONFIG_PM_ENABLE=y
|
||
CONFIG_FREERTOS_USE_TICKLESS_IDLE=n
|
||
CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y
|
||
CONFIG_PM_RESTORE_CACHE_TAGMEM_AFTER_LIGHT_SLEEP=y
|
||
CONFIG_PM_SLP_IRAM_OPT=y
|
||
|
||
CONFIG_TOUCH_PAD_ENABLE=y
|
||
CONFIG_ESP_DRIVER_TOUCH_SENS_ENABLE=n
|
||
|
||
CONFIG_LWIP_IPV6=n
|
||
CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=n
|
||
CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n
|
||
CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA=n
|
||
CONFIG_MBEDTLS_TLS_CLIENT=y
|
||
CONFIG_MBEDTLS_TLS_SERVER=n |