Skip to content

Commit 22cae61

Browse files
committed
Merge branch 'feature/enable_zc_extensions' into 'master'
Enable zc* extensions for riscv chips supported them Closes IDF-13918 See merge request espressif/esp-idf!40074
2 parents 6588b00 + dfac1a1 commit 22cae61

File tree

27 files changed

+259
-118
lines changed

27 files changed

+259
-118
lines changed

components/esp_system/include/esp_private/panic_internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ uint32_t panic_get_cause(const void* frame);
8888

8989
void panic_prepare_frame_from_ctx(void* frame);
9090

91+
void panic_clear_active_interrupts(const void* frame);
92+
9193
#ifdef __cplusplus
9294
}
9395
#endif

components/esp_system/panic.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ void esp_panic_handler(panic_info_t *info)
391391
PANIC_INFO_DUMP(info, state);
392392
panic_print_str("\r\n");
393393

394+
// Now, after all panic info was printed we can clear active interrupts
395+
panic_clear_active_interrupts(info->frame);
396+
394397
/* No matter if we come here from abort or an exception, this variable must be reset.
395398
* Else, any exception/error occurring during the current panic handler would considered
396399
* an abort. Do this after PANIC_INFO_DUMP(info, state) as it also checks this variable.

components/esp_system/port/arch/riscv/panic_arch.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,10 @@ void panic_prepare_frame_from_ctx(void* frame)
374374

375375
((RvExcFrame *)frame)->mhartid = RV_READ_CSR(mhartid);
376376
}
377+
378+
void panic_clear_active_interrupts(const void *frame)
379+
{
380+
if (((RvExcFrame *)frame)->mcause == ETS_CACHEERR_INUM) {
381+
esp_cache_err_clear_active_err();
382+
}
383+
}

components/esp_system/port/arch/xtensa/panic_arch.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,9 @@ void panic_prepare_frame_from_ctx(void* frame)
343343
/* Nothing to cleanup on xtensa */
344344
(void)frame;
345345
}
346+
347+
void panic_clear_active_interrupts(const void *frame)
348+
{
349+
/* Nothing to cleanup on xtensa */
350+
(void)frame;
351+
}

components/esp_system/port/include/private/esp_private/cache_err_int.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -58,6 +58,12 @@ void esp_cache_err_get_panic_info(esp_cache_err_info_t *err_info);
5858
*/
5959
bool esp_cache_err_has_active_err(void);
6060

61+
/**
62+
* @brief Clear any cache errors interrupt
63+
*
64+
*/
65+
void esp_cache_err_clear_active_err(void);
66+
6167
#if SOC_CACHE_ACS_INVALID_STATE_ON_PANIC
6268
/**
6369
* @brief Saves and clears active access errors

components/esp_system/port/soc/esp32c2/cache_err_int.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -134,6 +134,12 @@ bool esp_cache_err_has_active_err(void)
134134
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);
135135
}
136136

137+
void esp_cache_err_clear_active_err(void)
138+
{
139+
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
140+
cache_ll_l1_clear_illegal_error_intr(0, CACHE_LL_L1_ILG_EVENT_MASK);
141+
}
142+
137143
void esp_cache_err_int_init(void)
138144
{
139145
const uint32_t core_id = 0;

components/esp_system/port/soc/esp32c3/cache_err_int.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -134,6 +134,12 @@ bool esp_cache_err_has_active_err(void)
134134
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);
135135
}
136136

137+
void esp_cache_err_clear_active_err(void)
138+
{
139+
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
140+
cache_ll_l1_clear_illegal_error_intr(0, CACHE_LL_L1_ILG_EVENT_MASK);
141+
}
142+
137143
void esp_cache_err_int_init(void)
138144
{
139145
const uint32_t core_id = 0;

components/esp_system/port/soc/esp32c5/cache_err_int.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -40,6 +40,11 @@ bool esp_cache_err_has_active_err(void)
4040
return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
4141
}
4242

43+
void esp_cache_err_clear_active_err(void)
44+
{
45+
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
46+
}
47+
4348
void esp_cache_err_int_init(void)
4449
{
4550
const uint32_t core_id = 0;

components/esp_system/port/soc/esp32c6/cache_err_int.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -39,6 +39,11 @@ bool esp_cache_err_has_active_err(void)
3939
return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
4040
}
4141

42+
void esp_cache_err_clear_active_err(void)
43+
{
44+
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
45+
}
46+
4247
void esp_cache_err_int_init(void)
4348
{
4449
const uint32_t core_id = 0;

components/esp_system/port/soc/esp32c61/cache_err_int.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -39,6 +39,11 @@ bool esp_cache_err_has_active_err(void)
3939
return cache_ll_l1_get_access_error_intr_status(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
4040
}
4141

42+
void esp_cache_err_clear_active_err(void)
43+
{
44+
cache_ll_l1_clear_access_error_intr(0, CACHE_LL_L1_ACCESS_EVENT_MASK);
45+
}
46+
4247
void esp_cache_err_int_init(void)
4348
{
4449
const uint32_t core_id = 0;

0 commit comments

Comments
 (0)