From 2411f0f52ddf6c68263fd22eef3044a00ef9be70 Mon Sep 17 00:00:00 2001 From: Erhan Kurubas Date: Mon, 20 Jul 2026 12:10:16 +0200 Subject: [PATCH] feat(hal): implement enable_debug/enable_record for ESP32-S31 CPU utility --- .../hal/esp32s31/include/hal/cpu_utility_ll.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/components/hal/esp32s31/include/hal/cpu_utility_ll.h b/components/hal/esp32s31/include/hal/cpu_utility_ll.h index 0b3b606afdb..6e54d4b071d 100644 --- a/components/hal/esp32s31/include/hal/cpu_utility_ll.h +++ b/components/hal/esp32s31/include/hal/cpu_utility_ll.h @@ -11,6 +11,7 @@ #include "soc/pmu_struct.h" #include "soc/hp_system_reg.h" #include "soc/hp_sys_clkrst_reg.h" +#include "soc/assist_debug_reg.h" #include "esp_attr.h" #include "hal/misc.h" @@ -50,14 +51,20 @@ FORCE_INLINE_ATTR void cpu_utility_ll_unstall_cpu(uint32_t cpu_no) FORCE_INLINE_ATTR void cpu_utility_ll_enable_debug(uint32_t cpu_no) { - (void) cpu_no; - // TODO: IDF-14675 ASSIST_DEBUG is not supported yet on ESP32S31 + if (cpu_no == 0) { + REG_SET_BIT(ASSIST_DEBUG_CORE_0_RCD_EN_REG, ASSIST_DEBUG_CORE_0_RCD_PDEBUGEN); + } else { + REG_SET_BIT(ASSIST_DEBUG_CORE_1_RCD_EN_REG, ASSIST_DEBUG_CORE_1_RCD_PDEBUGEN); + } } FORCE_INLINE_ATTR void cpu_utility_ll_enable_record(uint32_t cpu_no) { - (void) cpu_no; - // TODO: IDF-14675 ASSIST_DEBUG is not supported yet on ESP32S31 + if (cpu_no == 0) { + REG_SET_BIT(ASSIST_DEBUG_CORE_0_RCD_EN_REG, ASSIST_DEBUG_CORE_0_RCD_RECORDEN); + } else { + REG_SET_BIT(ASSIST_DEBUG_CORE_1_RCD_EN_REG, ASSIST_DEBUG_CORE_1_RCD_RECORDEN); + } } FORCE_INLINE_ATTR void cpu_utility_ll_enable_clock_and_reset_app_cpu(void)