Skip to content

Commit bbcb4a2

Browse files
feat(ble): support enhanced controller log capabilities on ESP32-C2
1 parent f598976 commit bbcb4a2

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

components/bt/controller/esp32c2/Kconfig.in

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,19 @@ config BT_LE_LOG_HCI_BUF_SIZE
390390
help
391391
Configure the size of the BLE HCI LOG buffer.
392392

393+
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
394+
bool "Enable wrap panic handler"
395+
depends on BT_LE_CONTROLLER_LOG_ENABLED
396+
default n
397+
help
398+
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
399+
400+
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
401+
bool "Enable esp_task_wdt_isr_user_handler implementation"
402+
depends on BT_LE_CONTROLLER_LOG_ENABLED
403+
default n
404+
help
405+
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
393406
config BT_LE_LL_RESOLV_LIST_SIZE
394407
int "BLE LL Resolving list size"
395408
range 1 5

components/bt/controller/esp32c2/bt.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,21 @@ void esp_ble_controller_log_dump_all(bool output)
456456
portEXIT_CRITICAL_SAFE(&spinlock);
457457
}
458458
}
459+
#if CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
460+
void esp_task_wdt_isr_user_handler(void)
461+
{
462+
esp_ble_controller_log_dump_all(true);
463+
}
464+
#endif // CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
465+
466+
#if CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
467+
void __real_esp_panic_handler(void *info);
468+
void __wrap_esp_panic_handler (void *info)
469+
{
470+
esp_ble_controller_log_dump_all(true);
471+
__real_esp_panic_handler(info);
472+
}
473+
#endif // CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
459474
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
460475

461476
/* This variable tells if BLE is running */

0 commit comments

Comments
 (0)