mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
refactor(panic): route panic handlers through esp_sys_event
Let panic-related components register their hooks through esp_sys_event so panic sequencing stays extensible without hardcoded esp_system dependencies.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "esp_cpu.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "esp_debug_helpers.h"
|
||||
#include "esp_private/crosscore_int.h"
|
||||
#include "soc/periph_defs.h"
|
||||
#include "soc/system_intr.h"
|
||||
#include "hal/crosscore_int_ll.h"
|
||||
@@ -17,10 +18,6 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/portmacro.h"
|
||||
|
||||
#if CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
|
||||
#include "esp_gdbstub.h"
|
||||
#endif
|
||||
|
||||
#define REASON_YIELD BIT(0)
|
||||
#define REASON_FREQ_SWITCH BIT(1)
|
||||
#define REASON_PRINT_BACKTRACE BIT(2)
|
||||
@@ -30,6 +27,15 @@
|
||||
static portMUX_TYPE reason_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
static volatile uint32_t reason[CONFIG_FREERTOS_NUMBER_OF_CORES];
|
||||
|
||||
/* Weak no-op hook for the REASON_GDB_CALL crosscore interrupt. esp_gdbstub
|
||||
* provides a strong override (see gdbstub.c) when the runtime gdbstub is
|
||||
* enabled. Keeping the default here lets esp_system trigger the gdb-call
|
||||
* handling without taking any dependency on the esp_gdbstub component. Runs in
|
||||
* interrupt context, hence placed in IRAM. */
|
||||
void __attribute__((weak)) ESP_SYSTEM_IRAM_ATTR esp_crosscore_int_gdb_call_hook(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
ToDo: There is a small chance the CPU already has yielded when this ISR is serviced. In that case, it's running the intended task but
|
||||
the ISR will cause it to switch _away_ from it. portYIELD_FROM_ISR will probably just schedule the task again, but have to check that.
|
||||
@@ -64,11 +70,9 @@ static void ESP_SYSTEM_IRAM_ATTR esp_crosscore_isr(void *arg)
|
||||
* to allow DFS features without the extra latency of the ISR hook.
|
||||
*/
|
||||
}
|
||||
#if CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
|
||||
if (my_reason_val & REASON_GDB_CALL) {
|
||||
update_breakpoints();
|
||||
esp_crosscore_int_gdb_call_hook();
|
||||
}
|
||||
#endif // !CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
|
||||
|
||||
if (my_reason_val & REASON_PRINT_BACKTRACE) {
|
||||
esp_backtrace_print(100);
|
||||
|
||||
Reference in New Issue
Block a user