fix(esp_system): clear cache error interrupt in panic handler

This commit is contained in:
gaoxiaojie
2025-08-21 16:15:34 +08:00
committed by Alexey Lapshin
parent 73edc2903b
commit fab0bb1056
14 changed files with 80 additions and 8 deletions

View File

@@ -88,6 +88,8 @@ uint32_t panic_get_cause(const void* frame);
void panic_prepare_frame_from_ctx(void* frame); void panic_prepare_frame_from_ctx(void* frame);
void panic_clear_active_interrupts(const void* frame);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -391,6 +391,9 @@ void esp_panic_handler(panic_info_t *info)
PANIC_INFO_DUMP(info, state); PANIC_INFO_DUMP(info, state);
panic_print_str("\r\n"); panic_print_str("\r\n");
// Now, after all panic info was printed we can clear active interrupts
panic_clear_active_interrupts(info->frame);
/* No matter if we come here from abort or an exception, this variable must be reset. /* No matter if we come here from abort or an exception, this variable must be reset.
* Else, any exception/error occurring during the current panic handler would considered * Else, any exception/error occurring during the current panic handler would considered
* an abort. Do this after PANIC_INFO_DUMP(info, state) as it also checks this variable. * an abort. Do this after PANIC_INFO_DUMP(info, state) as it also checks this variable.

View File

@@ -374,3 +374,10 @@ void panic_prepare_frame_from_ctx(void* frame)
((RvExcFrame *)frame)->mhartid = RV_READ_CSR(mhartid); ((RvExcFrame *)frame)->mhartid = RV_READ_CSR(mhartid);
} }
void panic_clear_active_interrupts(const void *frame)
{
if (((RvExcFrame *)frame)->mcause == ETS_CACHEERR_INUM) {
esp_cache_err_clear_active_err();
}
}

View File

@@ -343,3 +343,9 @@ void panic_prepare_frame_from_ctx(void* frame)
/* Nothing to cleanup on xtensa */ /* Nothing to cleanup on xtensa */
(void)frame; (void)frame;
} }
void panic_clear_active_interrupts(const void *frame)
{
/* Nothing to cleanup on xtensa */
(void)frame;
}

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -58,6 +58,12 @@ void esp_cache_err_get_panic_info(esp_cache_err_info_t *err_info);
*/ */
bool esp_cache_err_has_active_err(void); bool esp_cache_err_has_active_err(void);
/**
* @brief Clear any cache errors interrupt
*
*/
void esp_cache_err_clear_active_err(void);
#if SOC_CACHE_ACS_INVALID_STATE_ON_PANIC #if SOC_CACHE_ACS_INVALID_STATE_ON_PANIC
/** /**
* @brief Saves and clears active access errors * @brief Saves and clears active access errors

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -134,6 +134,12 @@ bool esp_cache_err_has_active_err(void)
return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK) || cache_ll_l1_get_illegal_error_intr_status(0, CACHE_LL_L1_ILG_EVENT_MASK); return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK) || cache_ll_l1_get_illegal_error_intr_status(0, CACHE_LL_L1_ILG_EVENT_MASK);
} }
void esp_cache_err_clear_active_err(void)
{
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
cache_ll_l1_clear_illegal_error_intr(0, CACHE_LL_L1_ILG_EVENT_MASK);
}
void esp_cache_err_int_init(void) void esp_cache_err_int_init(void)
{ {
const uint32_t core_id = 0; const uint32_t core_id = 0;

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -134,6 +134,12 @@ bool esp_cache_err_has_active_err(void)
return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK) || cache_ll_l1_get_illegal_error_intr_status(0, CACHE_LL_L1_ILG_EVENT_MASK); return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK) || cache_ll_l1_get_illegal_error_intr_status(0, CACHE_LL_L1_ILG_EVENT_MASK);
} }
void esp_cache_err_clear_active_err(void)
{
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
cache_ll_l1_clear_illegal_error_intr(0, CACHE_LL_L1_ILG_EVENT_MASK);
}
void esp_cache_err_int_init(void) void esp_cache_err_int_init(void)
{ {
const uint32_t core_id = 0; const uint32_t core_id = 0;

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -40,6 +40,11 @@ bool esp_cache_err_has_active_err(void)
return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK); return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
} }
void esp_cache_err_clear_active_err(void)
{
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
}
void esp_cache_err_int_init(void) void esp_cache_err_int_init(void)
{ {
const uint32_t core_id = 0; const uint32_t core_id = 0;

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -39,6 +39,11 @@ bool esp_cache_err_has_active_err(void)
return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK); return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
} }
void esp_cache_err_clear_active_err(void)
{
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
}
void esp_cache_err_int_init(void) void esp_cache_err_int_init(void)
{ {
const uint32_t core_id = 0; const uint32_t core_id = 0;

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -39,6 +39,11 @@ bool esp_cache_err_has_active_err(void)
return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK); return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
} }
void esp_cache_err_clear_active_err(void)
{
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
}
void esp_cache_err_int_init(void) void esp_cache_err_int_init(void)
{ {
const uint32_t core_id = 0; const uint32_t core_id = 0;

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -39,6 +39,11 @@ bool esp_cache_err_has_active_err(void)
return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK); return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
} }
void esp_cache_err_clear_active_err(void)
{
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
}
void esp_cache_err_int_init(void) void esp_cache_err_int_init(void)
{ {
const uint32_t core_id = 0; const uint32_t core_id = 0;

View File

@@ -39,6 +39,11 @@ bool esp_cache_err_has_active_err(void)
return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK); return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
} }
void esp_cache_err_clear_active_err(void)
{
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
}
void esp_cache_err_int_init(void) void esp_cache_err_int_init(void)
{ {
const uint32_t core_id = 0; const uint32_t core_id = 0;

View File

@@ -39,6 +39,11 @@ bool esp_cache_err_has_active_err(void)
return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK); return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
} }
void esp_cache_err_clear_active_err(void)
{
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
}
void esp_cache_err_int_init(void) void esp_cache_err_int_init(void)
{ {
const uint32_t core_id = 0; const uint32_t core_id = 0;

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -41,6 +41,12 @@ bool esp_cache_err_has_active_err(void)
return has_active_err; return has_active_err;
} }
void esp_cache_err_clear_active_err(void)
{
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
cache_ll_l2_clear_access_error_intr(0, CACHE_LL_L2_ACCESS_EVENT_MASK);
}
void esp_cache_err_int_init(void) void esp_cache_err_int_init(void)
{ {
const uint32_t core_id = 0; const uint32_t core_id = 0;