From 519131a671c806d3c6fb33db6a7ba43e14ac6d54 Mon Sep 17 00:00:00 2001 From: zhanghaipeng Date: Tue, 12 May 2026 15:44:30 +0800 Subject: [PATCH 1/2] fix(bluedroid): correct format specifier in BLE create CIS debug log --- components/bt/host/bluedroid/stack/hcic/hciblecmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/host/bluedroid/stack/hcic/hciblecmds.c b/components/bt/host/bluedroid/stack/hcic/hciblecmds.c index 1f17d20f43e..901c672d20e 100644 --- a/components/bt/host/bluedroid/stack/hcic/hciblecmds.c +++ b/components/bt/host/bluedroid/stack/hcic/hciblecmds.c @@ -2476,7 +2476,7 @@ UINT8 btsnd_hcic_ble_iso_create_cis(uint8_t cis_count, struct ble_hci_cis_hdls * BT_HDR *p; UINT8 *pp; - HCI_TRACE_DEBUG("hci create cis: cig_id ", cis_count); + HCI_TRACE_DEBUG("hci create cis: cis_count %d", cis_count); // for (uint8_t i = 0; i < cis_count; i++) // { // HCI_TRACE_ERROR("i %d cis_hdl %d acl_hdl %d", i, cis_hdls[i].cis_hdl, cis_hdls[i].acl_hdl); From 0af57d731c1dc3c729109487540d18470b707f54 Mon Sep 17 00:00:00 2001 From: zhanghaipeng Date: Thu, 30 Apr 2026 19:54:18 +0800 Subject: [PATCH 2/2] feat(ble): Support BLE critical logs --- components/bt/Kconfig | 8 ++--- components/bt/common/Kconfig.in | 6 ++-- components/bt/common/ble_log/Kconfig.in | 26 ++++++++++---- components/bt/controller/esp32c3/Kconfig.in | 3 +- components/bt/host/bluedroid/Kconfig.in | 40 +++++++++++++++------ 5 files changed, 58 insertions(+), 25 deletions(-) diff --git a/components/bt/Kconfig b/components/bt/Kconfig index 058305253d1..37d9f32f30f 100644 --- a/components/bt/Kconfig +++ b/components/bt/Kconfig @@ -54,6 +54,10 @@ menu "Bluetooth" endchoice + menu "Common Options" + source "$IDF_PATH/components/bt/common/Kconfig.in" + endmenu + menu "Bluedroid Options" depends on BT_BLUEDROID_ENABLED source "$IDF_PATH/components/bt/host/bluedroid/Kconfig.in" @@ -80,10 +84,6 @@ menu "Bluetooth" We cannot split the memory into 3 different regions (IRAM, BLE-IRAM, DRAM). So this option will disable the memory protection scheme (ESP_SYSTEM_MEMPROT) - menu "Common Options" - source "$IDF_PATH/components/bt/common/Kconfig.in" - endmenu - config BT_HCI_LOG_DEBUG_EN depends on BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED bool "Enable Bluetooth HCI debug mode" diff --git a/components/bt/common/Kconfig.in b/components/bt/common/Kconfig.in index 3ab086b9c55..9c7e04d1ed7 100644 --- a/components/bt/common/Kconfig.in +++ b/components/bt/common/Kconfig.in @@ -162,7 +162,6 @@ menu "BT Logs" default n depends on !BT_STACK_NO_LOG select BLE_LOG_ENABLED - select BLE_COMPRESSED_LOG_ENABLE help Enable bandwidth-optimized logging for the BLE Log Async Output system. When enabled, only high-severity logs are captured and @@ -175,9 +174,9 @@ menu "BT Logs" if BT_LOG_CRITICAL_ONLY config BT_LOG_CRITICAL_ONLY_CTRL bool "Controller: bandwidth-optimized logging" - depends on SOC_ESP_NIMBLE_CONTROLLER || BT_CTRL_RUN_IN_FLASH_ONLY + depends on SOC_ESP_NIMBLE_CONTROLLER || BLE_LOG_IS_ESP_LEGACY_CONTROLLER select BT_LE_CONTROLLER_LOG_ENABLED if SOC_ESP_NIMBLE_CONTROLLER - select BT_CTRL_LE_LOG_EN if !SOC_ESP_NIMBLE_CONTROLLER + select BT_CTRL_LE_LOG_EN if BLE_LOG_IS_ESP_LEGACY_CONTROLLER default y help Enable controller log output via the async transport with @@ -186,7 +185,6 @@ menu "BT Logs" config BT_LOG_CRITICAL_ONLY_HOST bool "Host: bandwidth-optimized logging" - select BLE_HOST_COMPRESSED_LOG_ENABLE if BT_BLUEDROID_ENABLED default y help Enable host stack log encoding via the async transport. diff --git a/components/bt/common/ble_log/Kconfig.in b/components/bt/common/ble_log/Kconfig.in index 286a16b754c..5cb3bab284d 100644 --- a/components/bt/common/ble_log/Kconfig.in +++ b/components/bt/common/ble_log/Kconfig.in @@ -1,5 +1,7 @@ config BLE_LOG_ENABLED bool "Enable BT Log Async Output (Dev Only)" + select BLE_COMPRESSED_LOG_ENABLE + select BLE_HOST_COMPRESSED_LOG_ENABLE if BT_BLUEDROID_ENABLED default n help Enable BT Log Async Output @@ -63,16 +65,14 @@ if BLE_LOG_ENABLED bool "Current BLE Controller is ESP BLE Legacy Controller" depends on BT_CONTROLLER_ENABLED depends on !SOC_ESP_NIMBLE_CONTROLLER - depends on BT_CTRL_RUN_IN_FLASH_ONLY default y - select BT_CTRL_LE_LOG_EN - select BLE_LOG_LL_ENABLED help Current BLE Controller is ESP BLE Legacy Controller config BLE_LOG_LL_ENABLED bool "Enable BLE Log for Link Layer" depends on BT_CONTROLLER_ENABLED + default y if BLE_LOG_IS_ESP_LEGACY_CONTROLLER default n help Enable BLE Log for Link Layer @@ -112,11 +112,25 @@ if BLE_LOG_ENABLED it will be truncated. endif - config BLE_LOG_HOST_SIDE_HCI_LOG_ENABLED - bool "Enable BLE Host side HCI Logging" + config BLE_LOG_HOST_LOG + bool "Enable BLE Log for Host" + depends on BT_BLUEDROID_ENABLED default y help - Enable BLE Host side HCI Logging + Enable BLE Log for the Host stack (Bluedroid or NimBLE). + + When enabled, host-side log statements are routed through the + BLE Log async output transport instead of (or in addition to) + the standard UART logging path. Disable this option to keep + BLE Log enabled for the controller/link layer only. + + config BLE_LOG_HOST_SIDE_HCI_LOG_ENABLED + bool "Enable BLE Host side HCI Logging" + default y if BLE_LOG_IS_ESP_LEGACY_CONTROLLER + help + Enable HCI packet logging captured on the Host side + (Bluedroid / NimBLE HCI HAL). Useful for correlating + host events with controller-side HCI traces. config BLE_LOG_TS_ENABLED bool "Enable BLE Log Timestamp Synchronization (TS)" diff --git a/components/bt/controller/esp32c3/Kconfig.in b/components/bt/controller/esp32c3/Kconfig.in index ec53d82a7b6..d6acc873092 100644 --- a/components/bt/controller/esp32c3/Kconfig.in +++ b/components/bt/controller/esp32c3/Kconfig.in @@ -590,8 +590,9 @@ config BT_CTRL_BLE_MIN_CONN_INTERVAL_ENABLE menu "Controller debug log Options (Experimental)" config BT_CTRL_LE_LOG_EN - depends on BT_CTRL_RUN_IN_FLASH_ONLY bool "Enable BLE debug log" + select BT_CTRL_RUN_IN_FLASH_ONLY + default y if BLE_LOG_LL_ENABLED default n config BT_CTRL_LE_LOG_MODE_BLE_LOG_V2 diff --git a/components/bt/host/bluedroid/Kconfig.in b/components/bt/host/bluedroid/Kconfig.in index e5d6cecc0e5..8016b29381f 100644 --- a/components/bt/host/bluedroid/Kconfig.in +++ b/components/bt/host/bluedroid/Kconfig.in @@ -563,7 +563,9 @@ menu "BT DEBUG LOG LEVEL" choice BT_LOG_HCI_TRACE_LEVEL prompt "HCI layer" - default BT_LOG_HCI_TRACE_LEVEL_WARNING + default BT_LOG_HCI_TRACE_LEVEL_EVENT if BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_HCI_TRACE_LEVEL_VERBOSE if BLE_LOG_HOST_LOG && !BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_HCI_TRACE_LEVEL_WARNING if !BLE_LOG_ENABLED depends on BT_BLUEDROID_ENABLED && !BT_STACK_NO_LOG help Define BT trace level for HCI layer @@ -598,7 +600,9 @@ menu "BT DEBUG LOG LEVEL" choice BT_LOG_BTM_TRACE_LEVEL prompt "BTM layer" - default BT_LOG_BTM_TRACE_LEVEL_WARNING + default BT_LOG_BTM_TRACE_LEVEL_EVENT if BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_BTM_TRACE_LEVEL_VERBOSE if BLE_LOG_HOST_LOG && !BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_BTM_TRACE_LEVEL_WARNING if !BLE_LOG_ENABLED depends on BT_BLUEDROID_ENABLED && !BT_STACK_NO_LOG help Define BT trace level for BTM layer @@ -633,7 +637,9 @@ menu "BT DEBUG LOG LEVEL" choice BT_LOG_L2CAP_TRACE_LEVEL prompt "L2CAP layer" - default BT_LOG_L2CAP_TRACE_LEVEL_WARNING + default BT_LOG_L2CAP_TRACE_LEVEL_EVENT if BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_L2CAP_TRACE_LEVEL_VERBOSE if BLE_LOG_HOST_LOG && !BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_L2CAP_TRACE_LEVEL_WARNING if !BLE_LOG_ENABLED depends on BT_BLUEDROID_ENABLED && !BT_STACK_NO_LOG help Define BT trace level for L2CAP layer @@ -738,7 +744,9 @@ menu "BT DEBUG LOG LEVEL" choice BT_LOG_GAP_TRACE_LEVEL prompt "GAP layer" - default BT_LOG_GAP_TRACE_LEVEL_WARNING + default BT_LOG_GAP_TRACE_LEVEL_EVENT if BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_GAP_TRACE_LEVEL_VERBOSE if BLE_LOG_HOST_LOG && !BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_GAP_TRACE_LEVEL_WARNING if !BLE_LOG_ENABLED depends on BT_BLUEDROID_ENABLED && !BT_STACK_NO_LOG help Define BT trace level for GAP layer @@ -1053,7 +1061,9 @@ menu "BT DEBUG LOG LEVEL" choice BT_LOG_APPL_TRACE_LEVEL prompt "APPL layer" - default BT_LOG_APPL_TRACE_LEVEL_WARNING + default BT_LOG_APPL_TRACE_LEVEL_EVENT if BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_APPL_TRACE_LEVEL_VERBOSE if BLE_LOG_HOST_LOG && !BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_APPL_TRACE_LEVEL_WARNING if !BLE_LOG_ENABLED depends on BT_BLUEDROID_ENABLED && !BT_STACK_NO_LOG help Define BT trace level for APPL layer @@ -1088,7 +1098,9 @@ menu "BT DEBUG LOG LEVEL" choice BT_LOG_GATT_TRACE_LEVEL prompt "GATT layer" - default BT_LOG_GATT_TRACE_LEVEL_WARNING + default BT_LOG_GATT_TRACE_LEVEL_EVENT if BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_GATT_TRACE_LEVEL_VERBOSE if BLE_LOG_HOST_LOG && !BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_GATT_TRACE_LEVEL_WARNING if !BLE_LOG_ENABLED depends on BT_BLUEDROID_ENABLED && !BT_STACK_NO_LOG help Define BT trace level for GATT layer @@ -1123,7 +1135,9 @@ menu "BT DEBUG LOG LEVEL" choice BT_LOG_SMP_TRACE_LEVEL prompt "SMP layer" - default BT_LOG_SMP_TRACE_LEVEL_WARNING + default BT_LOG_SMP_TRACE_LEVEL_EVENT if BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_SMP_TRACE_LEVEL_VERBOSE if BLE_LOG_HOST_LOG && !BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_SMP_TRACE_LEVEL_WARNING if !BLE_LOG_ENABLED depends on BT_BLUEDROID_ENABLED && !BT_STACK_NO_LOG help Define BT trace level for SMP layer @@ -1158,7 +1172,9 @@ menu "BT DEBUG LOG LEVEL" choice BT_LOG_BTIF_TRACE_LEVEL prompt "BTIF layer" - default BT_LOG_BTIF_TRACE_LEVEL_WARNING + default BT_LOG_BTIF_TRACE_LEVEL_EVENT if BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_BTIF_TRACE_LEVEL_VERBOSE if BLE_LOG_HOST_LOG && !BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_BTIF_TRACE_LEVEL_WARNING if !BLE_LOG_ENABLED depends on BT_BLUEDROID_ENABLED && !BT_STACK_NO_LOG help Define BT trace level for BTIF layer @@ -1193,7 +1209,9 @@ menu "BT DEBUG LOG LEVEL" choice BT_LOG_BTC_TRACE_LEVEL prompt "BTC layer" - default BT_LOG_BTC_TRACE_LEVEL_WARNING + default BT_LOG_BTC_TRACE_LEVEL_EVENT if BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_BTC_TRACE_LEVEL_VERBOSE if BLE_LOG_HOST_LOG && !BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_BTC_TRACE_LEVEL_WARNING if !BLE_LOG_ENABLED depends on BT_BLUEDROID_ENABLED && !BT_STACK_NO_LOG help Define BT trace level for BTC layer @@ -1228,7 +1246,9 @@ menu "BT DEBUG LOG LEVEL" choice BT_LOG_OSI_TRACE_LEVEL prompt "OSI layer" - default BT_LOG_OSI_TRACE_LEVEL_WARNING + default BT_LOG_OSI_TRACE_LEVEL_EVENT if BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_OSI_TRACE_LEVEL_VERBOSE if BLE_LOG_HOST_LOG && !BT_LOG_CRITICAL_ONLY_HOST + default BT_LOG_OSI_TRACE_LEVEL_WARNING if !BLE_LOG_ENABLED depends on BT_BLUEDROID_ENABLED && !BT_STACK_NO_LOG help Define BT trace level for OSI layer