mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
Merge branch 'esp32h4_debug_asistant_v6.0' into 'release/v6.0'
feat(esp32h4): add assist_debug/bus_monitor support (v6.0) See merge request espressif/esp-idf!45949
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -38,15 +38,14 @@
|
|||||||
#include "soc/lp_wdt_reg.h"
|
#include "soc/lp_wdt_reg.h"
|
||||||
#include "hal/efuse_hal.h"
|
#include "hal/efuse_hal.h"
|
||||||
#include "hal/lpwdt_ll.h"
|
#include "hal/lpwdt_ll.h"
|
||||||
|
#include "hal/assist_debug_ll.h"
|
||||||
|
|
||||||
ESP_LOG_ATTR_TAG(TAG, "boot.esp32h4");
|
ESP_LOG_ATTR_TAG(TAG, "boot.esp32h4");
|
||||||
|
|
||||||
// TODO: [ESP32H4] support core1 bus monitor IDF-12592
|
|
||||||
static void wdt_reset_cpu0_info_enable(void)
|
static void wdt_reset_cpu0_info_enable(void)
|
||||||
{
|
{
|
||||||
REG_SET_BIT(PCR_ASSIST_CONF_REG, PCR_ASSIST_CLK_EN);
|
assist_debug_ll_enable_bus_clock(0, true);
|
||||||
REG_CLR_BIT(PCR_ASSIST_CONF_REG, PCR_ASSIST_RST_EN);
|
assist_debug_ll_enable_pc_recording(0, true);
|
||||||
REG_WRITE(BUS_MONITOR_CORE_0_RCD_EN_REG, BUS_MONITOR_CORE_0_RCD_PDEBUGEN | BUS_MONITOR_CORE_0_RCD_RECORDEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wdt_reset_info_dump(int cpu)
|
static void wdt_reset_info_dump(int cpu)
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ ESP_LOG_ATTR_TAG(TAG, "boot.esp32p4");
|
|||||||
|
|
||||||
static void wdt_reset_cpu0_info_enable(void)
|
static void wdt_reset_cpu0_info_enable(void)
|
||||||
{
|
{
|
||||||
_assist_debug_ll_enable_bus_clock(true);
|
_assist_debug_ll_enable_bus_clock(0, true);
|
||||||
REG_WRITE(ASSIST_DEBUG_CORE_0_RCD_EN_REG, ASSIST_DEBUG_CORE_0_RCD_PDEBUGEN | ASSIST_DEBUG_CORE_0_RCD_RECORDEN);
|
assist_debug_ll_enable_pc_recording(0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wdt_reset_info_dump(int cpu)
|
static void wdt_reset_info_dump(int cpu)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "esp_private/periph_ctrl.h"
|
#include "esp_private/periph_ctrl.h"
|
||||||
#include "esp_private/startup_internal.h"
|
#include "esp_private/startup_internal.h"
|
||||||
#include "soc/soc_caps.h"
|
#include "soc/soc_caps.h"
|
||||||
|
#include "soc/system_intr.h"
|
||||||
#include "esp_rom_sys.h"
|
#include "esp_rom_sys.h"
|
||||||
#include "esp_cpu.h"
|
#include "esp_cpu.h"
|
||||||
|
|
||||||
@@ -21,10 +22,12 @@ ESP_SYSTEM_INIT_FN(esp_hw_stack_guard_init, SECONDARY, ESP_SYSTEM_INIT_ALL_CORES
|
|||||||
PERIPH_RCC_ATOMIC()
|
PERIPH_RCC_ATOMIC()
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
assist_debug_ll_enable_bus_clock(true);
|
assist_debug_ll_enable_bus_clock(core_id, true);
|
||||||
assist_debug_ll_reset_register();
|
assist_debug_ll_reset_register(core_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assist_debug_ll_enable_pc_recording(core_id, true);
|
||||||
|
|
||||||
/* set interrupt to matrix */
|
/* set interrupt to matrix */
|
||||||
esp_rom_route_intr_matrix(core_id, ETS_ASSIST_DEBUG_INTR_SOURCE, ETS_ASSIST_DEBUG_INUM);
|
esp_rom_route_intr_matrix(core_id, ETS_ASSIST_DEBUG_INTR_SOURCE, ETS_ASSIST_DEBUG_INUM);
|
||||||
esprv_int_set_type(ETS_ASSIST_DEBUG_INUM, INTR_TYPE_LEVEL);
|
esprv_int_set_type(ETS_ASSIST_DEBUG_INUM, INTR_TYPE_LEVEL);
|
||||||
@@ -38,7 +41,7 @@ ESP_SYSTEM_INIT_FN(esp_hw_stack_guard_init, SECONDARY, ESP_SYSTEM_INIT_ALL_CORES
|
|||||||
* - trigger event happened
|
* - trigger event happened
|
||||||
* - you get an interrupt right after enabling interrupts
|
* - you get an interrupt right after enabling interrupts
|
||||||
* So, use monitor to disable hw_guard to avoid false-positives.
|
* So, use monitor to disable hw_guard to avoid false-positives.
|
||||||
* And keep interrupt always enabled for better performace (don't spend cpu time for enable/disable)
|
* And keep interrupt always enabled for better performance (don't spend cpu time for enable/disable)
|
||||||
*/
|
*/
|
||||||
assist_debug_hal_sp_int_enable(core_id);
|
assist_debug_hal_sp_int_enable(core_id);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -114,12 +114,16 @@ FORCE_INLINE_ATTR uint32_t assist_debug_ll_sp_spill_get_pc(__attribute__((unused
|
|||||||
return REG_READ(ASSIST_DEBUG_CORE_0_SP_PC_REG);
|
return REG_READ(ASSIST_DEBUG_CORE_0_SP_PC_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(bool enable)
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_pc_recording(uint32_t core_id, bool enable)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(__attribute__((unused)) uint32_t core_id, bool enable)
|
||||||
{
|
{
|
||||||
SYSTEM.cpu_peri_clk_en.clk_en_assist_debug = enable;
|
SYSTEM.cpu_peri_clk_en.clk_en_assist_debug = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(void)
|
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
|
||||||
{
|
{
|
||||||
SYSTEM.cpu_peri_rst_en.rst_en_assist_debug = true;
|
SYSTEM.cpu_peri_rst_en.rst_en_assist_debug = true;
|
||||||
SYSTEM.cpu_peri_rst_en.rst_en_assist_debug = false;
|
SYSTEM.cpu_peri_rst_en.rst_en_assist_debug = false;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -114,12 +114,16 @@ FORCE_INLINE_ATTR uint32_t assist_debug_ll_sp_spill_get_pc(__attribute__((unused
|
|||||||
return REG_READ(ASSIST_DEBUG_CORE_0_SP_PC_REG);
|
return REG_READ(ASSIST_DEBUG_CORE_0_SP_PC_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(bool enable)
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_pc_recording(uint32_t core_id, bool enable)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(__attribute__((unused)) uint32_t core_id, bool enable)
|
||||||
{
|
{
|
||||||
SYSTEM.cpu_peri_clk_en.reg_clk_en_assist_debug = enable;
|
SYSTEM.cpu_peri_clk_en.reg_clk_en_assist_debug = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(void)
|
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
|
||||||
{
|
{
|
||||||
SYSTEM.cpu_peri_rst_en.reg_rst_en_assist_debug = true;
|
SYSTEM.cpu_peri_rst_en.reg_rst_en_assist_debug = true;
|
||||||
SYSTEM.cpu_peri_rst_en.reg_rst_en_assist_debug = false;
|
SYSTEM.cpu_peri_rst_en.reg_rst_en_assist_debug = false;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -116,12 +116,16 @@ FORCE_INLINE_ATTR uint32_t assist_debug_ll_sp_spill_get_pc(__attribute__((unused
|
|||||||
return REG_READ(BUS_MONITOR_CORE_0_SP_PC_REG);
|
return REG_READ(BUS_MONITOR_CORE_0_SP_PC_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(bool enable)
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_pc_recording(uint32_t core_id, bool enable)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(__attribute__((unused)) uint32_t core_id, bool enable)
|
||||||
{
|
{
|
||||||
PCR.assist_conf.assist_clk_en = enable;
|
PCR.assist_conf.assist_clk_en = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(void)
|
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
|
||||||
{
|
{
|
||||||
PCR.assist_conf.assist_rst_en = true;
|
PCR.assist_conf.assist_rst_en = true;
|
||||||
PCR.assist_conf.assist_rst_en = false;
|
PCR.assist_conf.assist_rst_en = false;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -114,12 +114,16 @@ FORCE_INLINE_ATTR uint32_t assist_debug_ll_sp_spill_get_pc(__attribute__((unused
|
|||||||
return REG_READ(ASSIST_DEBUG_CORE_0_SP_PC_REG);
|
return REG_READ(ASSIST_DEBUG_CORE_0_SP_PC_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(bool enable)
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_pc_recording(uint32_t core_id, bool enable)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(__attribute__((unused)) uint32_t core_id, bool enable)
|
||||||
{
|
{
|
||||||
PCR.assist_conf.assist_clk_en = enable;
|
PCR.assist_conf.assist_clk_en = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(void)
|
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
|
||||||
{
|
{
|
||||||
PCR.assist_conf.assist_rst_en = true;
|
PCR.assist_conf.assist_rst_en = true;
|
||||||
PCR.assist_conf.assist_rst_en = false;
|
PCR.assist_conf.assist_rst_en = false;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -116,12 +116,16 @@ FORCE_INLINE_ATTR uint32_t assist_debug_ll_sp_spill_get_pc(__attribute__((unused
|
|||||||
return REG_READ(BUS_MONITOR_CORE_0_SP_PC_REG);
|
return REG_READ(BUS_MONITOR_CORE_0_SP_PC_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(bool enable)
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_pc_recording(uint32_t core_id, bool enable)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(__attribute__((unused)) uint32_t core_id, bool enable)
|
||||||
{
|
{
|
||||||
PCR.assist_conf.assist_clk_en = enable;
|
PCR.assist_conf.assist_clk_en = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(void)
|
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
|
||||||
{
|
{
|
||||||
PCR.assist_conf.assist_rst_en = true;
|
PCR.assist_conf.assist_rst_en = true;
|
||||||
PCR.assist_conf.assist_rst_en = false;
|
PCR.assist_conf.assist_rst_en = false;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -114,12 +114,16 @@ FORCE_INLINE_ATTR uint32_t assist_debug_ll_sp_spill_get_pc(__attribute__((unused
|
|||||||
return REG_READ(ASSIST_DEBUG_CORE_0_SP_PC_REG);
|
return REG_READ(ASSIST_DEBUG_CORE_0_SP_PC_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(bool enable)
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_pc_recording(uint32_t core_id, bool enable)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(__attribute__((unused)) uint32_t core_id, bool enable)
|
||||||
{
|
{
|
||||||
PCR.assist_conf.assist_clk_en = enable;
|
PCR.assist_conf.assist_clk_en = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(void)
|
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
|
||||||
{
|
{
|
||||||
PCR.assist_conf.assist_rst_en = true;
|
PCR.assist_conf.assist_rst_en = true;
|
||||||
PCR.assist_conf.assist_rst_en = false;
|
PCR.assist_conf.assist_rst_en = false;
|
||||||
|
|||||||
@@ -0,0 +1,179 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
// The LL layer for DEBUG_ASSIST peripheral
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "soc/assist_debug_reg.h"
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLER__
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "esp_attr.h"
|
||||||
|
#include "soc/pcr_struct.h"
|
||||||
|
#include "soc/bus_monitor_struct.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bus monitor peripheral provides stack overflow/underflow monitoring.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_sp_spill_monitor_enable(uint32_t core_id)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
BUS_MONITOR.monitor_core_1_montr_ena.monitor_core_1_sp_spill_min_ena = 1;
|
||||||
|
BUS_MONITOR.monitor_core_1_montr_ena.monitor_core_1_sp_spill_max_ena = 1;
|
||||||
|
} else {
|
||||||
|
BUS_MONITOR.monitor_core_0_montr_ena.monitor_core_0_sp_spill_min_ena = 1;
|
||||||
|
BUS_MONITOR.monitor_core_0_montr_ena.monitor_core_0_sp_spill_max_ena = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_sp_spill_monitor_disable(uint32_t core_id)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
BUS_MONITOR.monitor_core_1_montr_ena.monitor_core_1_sp_spill_min_ena = 0;
|
||||||
|
BUS_MONITOR.monitor_core_1_montr_ena.monitor_core_1_sp_spill_max_ena = 0;
|
||||||
|
} else {
|
||||||
|
BUS_MONITOR.monitor_core_0_montr_ena.monitor_core_0_sp_spill_min_ena = 0;
|
||||||
|
BUS_MONITOR.monitor_core_0_montr_ena.monitor_core_0_sp_spill_max_ena = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_sp_spill_interrupt_enable(uint32_t core_id)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
BUS_MONITOR.monitor_core_1_intr_ena.monitor_core_1_sp_spill_min_intr_ena = 1;
|
||||||
|
BUS_MONITOR.monitor_core_1_intr_ena.monitor_core_1_sp_spill_max_intr_ena = 1;
|
||||||
|
} else {
|
||||||
|
BUS_MONITOR.monitor_core_0_intr_ena.monitor_core_0_sp_spill_min_intr_ena = 1;
|
||||||
|
BUS_MONITOR.monitor_core_0_intr_ena.monitor_core_0_sp_spill_max_intr_ena = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_sp_spill_interrupt_disable(uint32_t core_id)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
BUS_MONITOR.monitor_core_1_intr_ena.monitor_core_1_sp_spill_min_intr_ena = 0;
|
||||||
|
BUS_MONITOR.monitor_core_1_intr_ena.monitor_core_1_sp_spill_max_intr_ena = 0;
|
||||||
|
} else {
|
||||||
|
BUS_MONITOR.monitor_core_0_intr_ena.monitor_core_0_sp_spill_min_intr_ena = 0;
|
||||||
|
BUS_MONITOR.monitor_core_0_intr_ena.monitor_core_0_sp_spill_max_intr_ena = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR bool assist_debug_ll_sp_spill_is_fired(uint32_t core_id)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
return BUS_MONITOR.monitor_core_1_intr_raw.monitor_core_1_sp_spill_min_raw || BUS_MONITOR.monitor_core_1_intr_raw.monitor_core_1_sp_spill_max_raw;
|
||||||
|
} else {
|
||||||
|
return BUS_MONITOR.monitor_core_0_intr_raw.monitor_core_0_sp_spill_min_raw || BUS_MONITOR.monitor_core_0_intr_raw.monitor_core_0_sp_spill_max_raw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_sp_spill_interrupt_clear(uint32_t core_id)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
BUS_MONITOR.monitor_core_1_intr_clr.monitor_core_1_sp_spill_min_clr = 1;
|
||||||
|
BUS_MONITOR.monitor_core_1_intr_clr.monitor_core_1_sp_spill_max_clr = 1;
|
||||||
|
} else {
|
||||||
|
BUS_MONITOR.monitor_core_0_intr_clr.monitor_core_0_sp_spill_min_clr = 1;
|
||||||
|
BUS_MONITOR.monitor_core_0_intr_clr.monitor_core_0_sp_spill_max_clr = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_sp_spill_set_min(uint32_t core_id, uint32_t min)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
BUS_MONITOR.monitor_core_1_sp_min.monitor_core_1_sp_min = min;
|
||||||
|
} else {
|
||||||
|
BUS_MONITOR.monitor_core_0_sp_min.monitor_core_0_sp_min = min;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR uint32_t assist_debug_ll_sp_spill_get_min(uint32_t core_id)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
return BUS_MONITOR.monitor_core_1_sp_min.monitor_core_1_sp_min;
|
||||||
|
} else {
|
||||||
|
return BUS_MONITOR.monitor_core_0_sp_min.monitor_core_0_sp_min;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_sp_spill_set_max(uint32_t core_id, uint32_t max)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
BUS_MONITOR.monitor_core_1_sp_max.monitor_core_1_sp_max = max;
|
||||||
|
} else {
|
||||||
|
BUS_MONITOR.monitor_core_0_sp_max.monitor_core_0_sp_max = max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR uint32_t assist_debug_ll_sp_spill_get_max(uint32_t core_id)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
return BUS_MONITOR.monitor_core_1_sp_max.monitor_core_1_sp_max;
|
||||||
|
} else {
|
||||||
|
return BUS_MONITOR.monitor_core_0_sp_max.monitor_core_0_sp_max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR uint32_t assist_debug_ll_sp_spill_get_pc(uint32_t core_id)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
return BUS_MONITOR.monitor_core_1_sp_pc.monitor_core_1_sp_pc;
|
||||||
|
} else {
|
||||||
|
return BUS_MONITOR.monitor_core_0_sp_pc.monitor_core_0_sp_pc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_pc_recording(uint32_t core_id, bool enable)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
BUS_MONITOR.monitor_core_1_rcd_en.monitor_core_1_rcd_pdebugen = enable;
|
||||||
|
BUS_MONITOR.monitor_core_1_rcd_en.monitor_core_1_rcd_recorden = enable;
|
||||||
|
} else {
|
||||||
|
BUS_MONITOR.monitor_core_0_rcd_en.monitor_core_0_rcd_pdebugen = enable;
|
||||||
|
BUS_MONITOR.monitor_core_0_rcd_en.monitor_core_0_rcd_recorden = enable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(uint32_t core_id, bool enable)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
PCR.assist_conf.assist1_clk_en = enable;
|
||||||
|
} else {
|
||||||
|
PCR.assist_conf.assist_clk_en = enable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(uint32_t core_id)
|
||||||
|
{
|
||||||
|
if (core_id) {
|
||||||
|
PCR.assist_conf.assist1_rst_en = true;
|
||||||
|
PCR.assist_conf.assist1_rst_en = false;
|
||||||
|
} else {
|
||||||
|
PCR.assist_conf.assist_rst_en = true;
|
||||||
|
PCR.assist_conf.assist_rst_en = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR bool assist_debug_ll_is_debugger_active(void)
|
||||||
|
{
|
||||||
|
return BUS_MONITOR.monitor_core_0_debug_mode.monitor_core_0_debug_module_active;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __ASSEMBLER__
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -116,7 +116,19 @@ FORCE_INLINE_ATTR uint32_t assist_debug_ll_sp_spill_get_pc(uint32_t core_id)
|
|||||||
return REG_READ(core_id ? ASSIST_DEBUG_CORE_1_SP_PC_REG : ASSIST_DEBUG_CORE_0_SP_PC_REG);
|
return REG_READ(core_id ? ASSIST_DEBUG_CORE_1_SP_PC_REG : ASSIST_DEBUG_CORE_0_SP_PC_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void _assist_debug_ll_enable_bus_clock(bool enable)
|
FORCE_INLINE_ATTR void assist_debug_ll_enable_pc_recording(uint32_t core_id, bool enable)
|
||||||
|
{
|
||||||
|
uint32_t reg = core_id ? ASSIST_DEBUG_CORE_1_RCD_EN_REG : ASSIST_DEBUG_CORE_0_RCD_EN_REG;
|
||||||
|
uint32_t bits = ASSIST_DEBUG_CORE_0_RCD_PDEBUGEN | ASSIST_DEBUG_CORE_0_RCD_RECORDEN;
|
||||||
|
|
||||||
|
if (enable) {
|
||||||
|
REG_SET_BIT(reg, bits);
|
||||||
|
} else {
|
||||||
|
REG_CLR_BIT(reg, bits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCE_INLINE_ATTR void _assist_debug_ll_enable_bus_clock(__attribute__((unused)) uint32_t core_id, bool enable)
|
||||||
{
|
{
|
||||||
HP_SYS_CLKRST.soc_clk_ctrl0.reg_busmon_cpu_clk_en = enable;
|
HP_SYS_CLKRST.soc_clk_ctrl0.reg_busmon_cpu_clk_en = enable;
|
||||||
REG_SET_FIELD(ASSIST_DEBUG_CLOCK_GATE_REG, ASSIST_DEBUG_CLK_EN, enable);
|
REG_SET_FIELD(ASSIST_DEBUG_CLOCK_GATE_REG, ASSIST_DEBUG_CLK_EN, enable);
|
||||||
@@ -124,7 +136,7 @@ FORCE_INLINE_ATTR void _assist_debug_ll_enable_bus_clock(bool enable)
|
|||||||
#define assist_debug_ll_enable_bus_clock(...) \
|
#define assist_debug_ll_enable_bus_clock(...) \
|
||||||
(void)__DECLARE_RCC_ATOMIC_ENV; _assist_debug_ll_enable_bus_clock(__VA_ARGS__)
|
(void)__DECLARE_RCC_ATOMIC_ENV; _assist_debug_ll_enable_bus_clock(__VA_ARGS__)
|
||||||
|
|
||||||
FORCE_INLINE_ATTR void _assist_debug_ll_reset_register(void)
|
FORCE_INLINE_ATTR void _assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
|
||||||
{
|
{
|
||||||
/* esp32p4 has no assist_debug reset register: disable & clear interrupts manually. */
|
/* esp32p4 has no assist_debug reset register: disable & clear interrupts manually. */
|
||||||
for (int i = 0; i < SOC_CPU_CORES_NUM; i++) {
|
for (int i = 0; i < SOC_CPU_CORES_NUM; i++) {
|
||||||
@@ -132,8 +144,6 @@ FORCE_INLINE_ATTR void _assist_debug_ll_reset_register(void)
|
|||||||
assist_debug_ll_sp_spill_interrupt_clear(i);
|
assist_debug_ll_sp_spill_interrupt_clear(i);
|
||||||
assist_debug_ll_sp_spill_set_min(i, 0);
|
assist_debug_ll_sp_spill_set_min(i, 0);
|
||||||
assist_debug_ll_sp_spill_set_max(i, 0xffffffff);
|
assist_debug_ll_sp_spill_set_max(i, 0xffffffff);
|
||||||
/* Enable PC register storing when trigger stack monitor. */
|
|
||||||
REG_WRITE(i ? ASSIST_DEBUG_CORE_1_RCD_EN_REG : ASSIST_DEBUG_CORE_0_RCD_EN_REG, ASSIST_DEBUG_CORE_1_RCD_PDEBUGEN | ASSIST_DEBUG_CORE_1_RCD_RECORDEN);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#define assist_debug_ll_reset_register(...) \
|
#define assist_debug_ll_reset_register(...) \
|
||||||
|
|||||||
@@ -127,6 +127,10 @@ config SOC_CLK_TREE_SUPPORTED
|
|||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
config SOC_ASSIST_DEBUG_SUPPORTED
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
|
||||||
config SOC_WDT_SUPPORTED
|
config SOC_WDT_SUPPORTED
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -13,6 +13,10 @@
|
|||||||
#define ASSIST_DEBUG_CORE_0_DEBUG_MODE_REG BUS_MONITOR_CORE_0_DEBUG_MODE_REG
|
#define ASSIST_DEBUG_CORE_0_DEBUG_MODE_REG BUS_MONITOR_CORE_0_DEBUG_MODE_REG
|
||||||
#define ASSIST_DEBUG_CORE_0_DEBUG_MODULE_ACTIVE BUS_MONITOR_CORE_0_DEBUG_MODULE_ACTIVE
|
#define ASSIST_DEBUG_CORE_0_DEBUG_MODULE_ACTIVE BUS_MONITOR_CORE_0_DEBUG_MODULE_ACTIVE
|
||||||
|
|
||||||
|
#define ASSIST_DEBUG_CORE_0_MONTR_ENA_REG BUS_MONITOR_CORE_0_MONTR_ENA_REG
|
||||||
|
#define ASSIST_DEBUG_CORE_0_SP_SPILL_MIN_ENA BUS_MONITOR_CORE_0_SP_SPILL_MIN_ENA
|
||||||
|
#define ASSIST_DEBUG_CORE_0_SP_SPILL_MAX_ENA BUS_MONITOR_CORE_0_SP_SPILL_MAX_ENA
|
||||||
|
|
||||||
#define ASSIST_DEBUG_CORE_0_SP_MIN_REG BUS_MONITOR_CORE_0_SP_MIN_REG
|
#define ASSIST_DEBUG_CORE_0_SP_MIN_REG BUS_MONITOR_CORE_0_SP_MIN_REG
|
||||||
#define ASSIST_DEBUG_CORE_0_SP_MAX_REG BUS_MONITOR_CORE_0_SP_MAX_REG
|
#define ASSIST_DEBUG_CORE_0_SP_MAX_REG BUS_MONITOR_CORE_0_SP_MAX_REG
|
||||||
|
|
||||||
@@ -20,12 +24,24 @@
|
|||||||
#define ASSIST_DEBUG_CORE_0_RCD_PDEBUGEN BUS_MONITOR_CORE_0_RCD_PDEBUGEN
|
#define ASSIST_DEBUG_CORE_0_RCD_PDEBUGEN BUS_MONITOR_CORE_0_RCD_PDEBUGEN
|
||||||
#define ASSIST_DEBUG_CORE_0_RCD_RECORDEN BUS_MONITOR_CORE_0_RCD_RECORDEN
|
#define ASSIST_DEBUG_CORE_0_RCD_RECORDEN BUS_MONITOR_CORE_0_RCD_RECORDEN
|
||||||
|
|
||||||
|
#define ASSIST_DEBUG_CORE_0_INTR_ENA_REG BUS_MONITOR_CORE_0_INTR_ENA_REG
|
||||||
|
|
||||||
#define ASSIST_DEBUG_CORE_1_DEBUG_MODE_REG BUS_MONITOR_CORE_1_DEBUG_MODE_REG
|
#define ASSIST_DEBUG_CORE_1_DEBUG_MODE_REG BUS_MONITOR_CORE_1_DEBUG_MODE_REG
|
||||||
#define ASSIST_DEBUG_CORE_1_DEBUG_MODULE_ACTIVE BUS_MONITOR_CORE_1_DEBUG_MODULE_ACTIVE
|
#define ASSIST_DEBUG_CORE_1_DEBUG_MODULE_ACTIVE BUS_MONITOR_CORE_1_DEBUG_MODULE_ACTIVE
|
||||||
|
|
||||||
|
#define ASSIST_DEBUG_CORE_1_MONTR_ENA_REG BUS_MONITOR_CORE_1_MONTR_ENA_REG
|
||||||
|
#define ASSIST_DEBUG_CORE_1_SP_SPILL_MIN_ENA BUS_MONITOR_CORE_1_SP_SPILL_MIN_ENA
|
||||||
|
#define ASSIST_DEBUG_CORE_1_SP_SPILL_MAX_ENA BUS_MONITOR_CORE_1_SP_SPILL_MAX_ENA
|
||||||
|
|
||||||
#define ASSIST_DEBUG_CORE_1_SP_MIN_REG BUS_MONITOR_CORE_1_SP_MIN_REG
|
#define ASSIST_DEBUG_CORE_1_SP_MIN_REG BUS_MONITOR_CORE_1_SP_MIN_REG
|
||||||
#define ASSIST_DEBUG_CORE_1_SP_MAX_REG BUS_MONITOR_CORE_1_SP_MAX_REG
|
#define ASSIST_DEBUG_CORE_1_SP_MAX_REG BUS_MONITOR_CORE_1_SP_MAX_REG
|
||||||
|
|
||||||
#define ASSIST_DEBUG_CORE_1_RCD_EN_REG BUS_MONITOR_CORE_1_RCD_EN_REG
|
#define ASSIST_DEBUG_CORE_1_RCD_EN_REG BUS_MONITOR_CORE_1_RCD_EN_REG
|
||||||
#define ASSIST_DEBUG_CORE_1_RCD_PDEBUGEN BUS_MONITOR_CORE_1_RCD_PDEBUGEN
|
#define ASSIST_DEBUG_CORE_1_RCD_PDEBUGEN BUS_MONITOR_CORE_1_RCD_PDEBUGEN
|
||||||
#define ASSIST_DEBUG_CORE_1_RCD_RECORDEN BUS_MONITOR_CORE_1_RCD_RECORDEN
|
#define ASSIST_DEBUG_CORE_1_RCD_RECORDEN BUS_MONITOR_CORE_1_RCD_RECORDEN
|
||||||
|
|
||||||
|
#define ASSIST_DEBUG_CORE_1_INTR_ENA_REG BUS_MONITOR_CORE_1_INTR_ENA_REG
|
||||||
|
|
||||||
|
#define ASSIST_DEBUG_SP_SPILL_BITS (ASSIST_DEBUG_CORE_0_SP_SPILL_MIN_ENA | ASSIST_DEBUG_CORE_0_SP_SPILL_MAX_ENA)
|
||||||
|
#define ASSIST_DEBUG_CORE_0_MONITOR_REG ASSIST_DEBUG_CORE_0_MONTR_ENA_REG
|
||||||
|
#define ASSIST_DEBUG_CORE_1_MONITOR_REG ASSIST_DEBUG_CORE_1_MONTR_ENA_REG
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
// #define SOC_ULP_LP_UART_SUPPORTED 1 // TODO: [ESP32H4] IDF-12445 IDF-12451
|
// #define SOC_ULP_LP_UART_SUPPORTED 1 // TODO: [ESP32H4] IDF-12445 IDF-12451
|
||||||
#define SOC_REG_I2C_SUPPORTED 1
|
#define SOC_REG_I2C_SUPPORTED 1
|
||||||
#define SOC_CLK_TREE_SUPPORTED 1
|
#define SOC_CLK_TREE_SUPPORTED 1
|
||||||
// #define SOC_ASSIST_DEBUG_SUPPORTED 1 // TODO: [ESP32H4] IDF-12310
|
#define SOC_ASSIST_DEBUG_SUPPORTED 1
|
||||||
#define SOC_WDT_SUPPORTED 1
|
#define SOC_WDT_SUPPORTED 1
|
||||||
#define SOC_SPI_FLASH_SUPPORTED 1 // TODO: [ESP32H4] IDF-12388
|
#define SOC_SPI_FLASH_SUPPORTED 1 // TODO: [ESP32H4] IDF-12388
|
||||||
#define SOC_SPIRAM_SUPPORTED 1
|
#define SOC_SPIRAM_SUPPORTED 1
|
||||||
|
|||||||
@@ -15,3 +15,5 @@
|
|||||||
|
|
||||||
#define SYS_TG0_WDT_INTR_SOURCE ETS_TG0_WDT_INTR_SOURCE
|
#define SYS_TG0_WDT_INTR_SOURCE ETS_TG0_WDT_INTR_SOURCE
|
||||||
#define SYS_TG1_WDT_INTR_SOURCE ETS_TG1_WDT_INTR_SOURCE
|
#define SYS_TG1_WDT_INTR_SOURCE ETS_TG1_WDT_INTR_SOURCE
|
||||||
|
|
||||||
|
#define ETS_ASSIST_DEBUG_INTR_SOURCE ETS_BUS_MONITOR_INTR_SOURCE
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
PROVIDE ( TRACE0 = 0x60000000 );
|
PROVIDE ( TRACE0 = 0x60000000 );
|
||||||
PROVIDE ( TRACE1 = 0x60001000 );
|
PROVIDE ( TRACE1 = 0x60001000 );
|
||||||
PROVIDE ( ASSIST_DEBUG = 0x60002000 );
|
PROVIDE ( BUS_MONITOR = 0x60002000 );
|
||||||
PROVIDE ( INTPRI = 0x60005000 );
|
PROVIDE ( INTPRI = 0x60005000 );
|
||||||
PROVIDE ( CACHE = 0x60008000 );
|
PROVIDE ( CACHE = 0x60008000 );
|
||||||
PROVIDE ( GPSPI2 = 0x60010000 );
|
PROVIDE ( GPSPI2 = 0x60010000 );
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
PROVIDE ( TRACE0 = 0x60000000 );
|
PROVIDE ( TRACE0 = 0x60000000 );
|
||||||
PROVIDE ( TRACE1 = 0x60001000 );
|
PROVIDE ( TRACE1 = 0x60001000 );
|
||||||
PROVIDE ( ASSIST_DEBUG = 0x60002000 );
|
PROVIDE ( BUS_MONITOR = 0x60002000 );
|
||||||
PROVIDE ( INTPRI = 0x60005000 );
|
PROVIDE ( INTPRI = 0x60005000 );
|
||||||
PROVIDE ( CACHE = 0x60008000 );
|
PROVIDE ( CACHE = 0x60008000 );
|
||||||
PROVIDE ( GPSPI2 = 0x60010000 );
|
PROVIDE ( GPSPI2 = 0x60010000 );
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "soc/soc.h"
|
#include "soc/soc.h"
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
Reference in New Issue
Block a user