Merge branch 'feat/add_save_debug_context_250226_v5.1' into 'release/v5.1'

Feat/add save debug context 250226 (v5.1)

See merge request espressif/esp-idf!37294
This commit is contained in:
Island 2025-02-27 10:40:00 +08:00
commit 50e63edc9d
7 changed files with 48 additions and 9 deletions

View File

@ -772,11 +772,24 @@ if(CONFIG_BT_ENABLED)
endif()
set(bt_priv_requires
nvs_flash
soc
esp_pm
esp_phy
esp_coex
mbedtls
driver
vfs
esp_gdbstub
)
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
REQUIRES esp_timer esp_wifi
PRIV_REQUIRES nvs_flash soc esp_pm esp_phy esp_coex mbedtls driver vfs
PRIV_REQUIRES "${bt_priv_requires}"
LDFRAGMENTS "${ldscripts}")
if(CONFIG_BT_ENABLED)

View File

@ -81,6 +81,10 @@ menu "Bluetooth"
We cannot split the memory into 3 different regions (IRAM, BLE-IRAM, DRAM).
So this option will disable the PMP (ESP_SYSTEM_PMP_IDRAM_SPLIT)
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"
@ -106,12 +110,6 @@ menu "Bluetooth"
This option is to configure the buffer size of the hci adv report cache in hci debug mode.
This is a ring buffer, the new data will overwrite the oldest data if the buffer is full.
menu "Common Options"
visible if (BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED)
source "$IDF_PATH/components/bt/common/Kconfig.in"
endmenu
endmenu
menuconfig BLE_MESH

View File

@ -1,6 +1,7 @@
config BT_ALARM_MAX_NUM
int "Maximum number of Bluetooth alarms"
default 50
depends on (BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED)
help
This option decides the maximum number of alarms which
could be used by Bluetooth host.

View File

@ -428,6 +428,12 @@ menu "Controller debug features"
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
default n
config BT_LE_DEBUG_REMAIN_SCENE_ENABLED
bool "Remain scene with GDB to capture relevant status info(Experimental)"
default n
help
Retain scene with GDB to capture info, requires disabling WDT (CONFIG_ESP_INT_WDT, CONFIG_ESP_TASK_WDT_EN).
endmenu
config BT_LE_LL_RESOLV_LIST_SIZE

View File

@ -1654,6 +1654,10 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
#include "esp_gdbstub.h"
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
int IRAM_ATTR
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
{
@ -1664,7 +1668,11 @@ ble_capture_info_user_handler(uint8_t type, uint32_t reason)
for (i = 0; i < 2; i++) {
esp_ble_controller_info_capture(0x010101);
}
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
uintptr_t sp;
__asm__ volatile ("mv %0, sp" : "=r" (sp));
esp_gdbstub_panic_handler(&sp);
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
break;
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
case 1:

View File

@ -419,6 +419,12 @@ menu "Controller debug features"
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
default n
config BT_LE_DEBUG_REMAIN_SCENE_ENABLED
bool "Remain scene with GDB to capture relevant status info(Experimental)"
default n
help
Retain scene with GDB to capture info, requires disabling WDT (CONFIG_ESP_INT_WDT, CONFIG_ESP_TASK_WDT_EN).
endmenu
config BT_LE_LL_RESOLV_LIST_SIZE

View File

@ -1633,6 +1633,9 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
#include "esp_gdbstub.h"
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
int IRAM_ATTR
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
@ -1644,7 +1647,11 @@ ble_capture_info_user_handler(uint8_t type, uint32_t reason)
for (i = 0; i < 2; i++) {
esp_ble_controller_info_capture(0x010101);
}
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
uintptr_t sp;
__asm__ volatile ("mv %0, sp" : "=r" (sp));
esp_gdbstub_panic_handler(&sp);
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
break;
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
case 1: