From 0c9ac7df6d213f53bd4fc3a9fa8a085f0e02600c Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 21 Dec 2022 21:16:40 +0100 Subject: [PATCH] system: disable interrupts in esp_restart_noos_dig --- components/esp_system/port/esp_system_chip.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/esp_system/port/esp_system_chip.c b/components/esp_system/port/esp_system_chip.c index db46659454..4e45e85003 100644 --- a/components/esp_system/port/esp_system_chip.c +++ b/components/esp_system/port/esp_system_chip.c @@ -16,6 +16,15 @@ void IRAM_ATTR esp_restart_noos_dig(void) { + // In case any of the calls below results in re-enabling of interrupts + // (for example, by entering a critical section), disable all the + // interrupts (e.g. from watchdogs) here. +#ifdef CONFIG_IDF_TARGET_ARCH_RISCV + rv_utils_intr_global_disable(); +#else + xt_ints_off(0xFFFFFFFF); +#endif + // make sure all the panic handler output is sent from UART FIFO if (CONFIG_ESP_CONSOLE_UART_NUM >= 0) { esp_rom_uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);