mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
TWDT: the Kconfig option ESP_TASK_WDT_EN is now used to enable Task Watchdog
This commit is contained in:
parent
1840c48538
commit
6b4e1619d8
@ -25,7 +25,7 @@ else()
|
|||||||
"xt_wdt.c"
|
"xt_wdt.c"
|
||||||
"debug_stubs.c")
|
"debug_stubs.c")
|
||||||
|
|
||||||
if(CONFIG_ESP_TASK_WDT)
|
if(CONFIG_ESP_TASK_WDT_EN)
|
||||||
list(APPEND srcs "task_wdt/task_wdt.c")
|
list(APPEND srcs "task_wdt/task_wdt.c")
|
||||||
|
|
||||||
if(CONFIG_ESP_TASK_WDT_USE_ESP_TIMER)
|
if(CONFIG_ESP_TASK_WDT_USE_ESP_TIMER)
|
||||||
|
@ -390,7 +390,7 @@ menu "ESP System Settings"
|
|||||||
help
|
help
|
||||||
Also detect if interrupts on CPU 1 are disabled for too long.
|
Also detect if interrupts on CPU 1 are disabled for too long.
|
||||||
|
|
||||||
config ESP_TASK_WDT
|
config ESP_TASK_WDT_EN
|
||||||
bool "Enable Task Watchdog Timer"
|
bool "Enable Task Watchdog Timer"
|
||||||
default y
|
default y
|
||||||
select FREERTOS_ENABLE_TASK_SNAPSHOT
|
select FREERTOS_ENABLE_TASK_SNAPSHOT
|
||||||
@ -404,14 +404,14 @@ menu "ESP System Settings"
|
|||||||
# Software implementation of Task Watchdog, handy for targets with only a single
|
# Software implementation of Task Watchdog, handy for targets with only a single
|
||||||
# Timer Group, such as the ESP32-C2
|
# Timer Group, such as the ESP32-C2
|
||||||
bool
|
bool
|
||||||
depends on ESP_TASK_WDT
|
depends on ESP_TASK_WDT_EN
|
||||||
default y if IDF_TARGET_ESP32C2
|
default y if IDF_TARGET_ESP32C2
|
||||||
default n if !IDF_TARGET_ESP32C2
|
default n if !IDF_TARGET_ESP32C2
|
||||||
select ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD
|
select ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD
|
||||||
|
|
||||||
config ESP_TASK_WDT_INIT
|
config ESP_TASK_WDT_INIT
|
||||||
bool "Initialize Task Watchdog Timer on startup"
|
bool "Initialize Task Watchdog Timer on startup"
|
||||||
depends on ESP_TASK_WDT
|
depends on ESP_TASK_WDT_EN
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Enabling this option will cause the Task Watchdog Timer to be initialized
|
Enabling this option will cause the Task Watchdog Timer to be initialized
|
||||||
|
@ -96,14 +96,14 @@ static void IRAM_ATTR esp_crosscore_isr(void *arg) {
|
|||||||
esp_backtrace_print(100);
|
esp_backtrace_print(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_ESP_TASK_WDT
|
#if CONFIG_ESP_TASK_WDT_EN
|
||||||
if (my_reason_val & REASON_TWDT_ABORT) {
|
if (my_reason_val & REASON_TWDT_ABORT) {
|
||||||
extern void task_wdt_timeout_abort_xtensa(bool);
|
extern void task_wdt_timeout_abort_xtensa(bool);
|
||||||
/* Called from a crosscore interrupt, thus, we are not the core that received
|
/* Called from a crosscore interrupt, thus, we are not the core that received
|
||||||
* the TWDT interrupt, call the function with `false` as a parameter. */
|
* the TWDT interrupt, call the function with `false` as a parameter. */
|
||||||
task_wdt_timeout_abort_xtensa(false);
|
task_wdt_timeout_abort_xtensa(false);
|
||||||
}
|
}
|
||||||
#endif // CONFIG_ESP_TASK_WDT
|
#endif // CONFIG_ESP_TASK_WDT_EN
|
||||||
#endif // CONFIG_IDF_TARGET_ARCH_XTENSA
|
#endif // CONFIG_IDF_TARGET_ARCH_XTENSA
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,9 +173,9 @@ void IRAM_ATTR esp_crosscore_int_send_print_backtrace(int core_id)
|
|||||||
esp_crosscore_int_send(core_id, REASON_PRINT_BACKTRACE);
|
esp_crosscore_int_send(core_id, REASON_PRINT_BACKTRACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_ESP_TASK_WDT
|
#if CONFIG_ESP_TASK_WDT_EN
|
||||||
void IRAM_ATTR esp_crosscore_int_send_twdt_abort(int core_id) {
|
void IRAM_ATTR esp_crosscore_int_send_twdt_abort(int core_id) {
|
||||||
esp_crosscore_int_send(core_id, REASON_TWDT_ABORT);
|
esp_crosscore_int_send(core_id, REASON_TWDT_ABORT);
|
||||||
}
|
}
|
||||||
#endif // CONFIG_ESP_TASK_WDT
|
#endif // CONFIG_ESP_TASK_WDT_EN
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,7 +61,7 @@ void esp_crosscore_int_send_gdb_call(int core_id);
|
|||||||
*/
|
*/
|
||||||
void esp_crosscore_int_send_print_backtrace(int core_id);
|
void esp_crosscore_int_send_print_backtrace(int core_id);
|
||||||
|
|
||||||
#if CONFIG_ESP_TASK_WDT
|
#if CONFIG_ESP_TASK_WDT_EN
|
||||||
/**
|
/**
|
||||||
* Send an interrupt to a CPU indicating it call `task_wdt_timeout_abort_xtensa`.
|
* Send an interrupt to a CPU indicating it call `task_wdt_timeout_abort_xtensa`.
|
||||||
* This will make the CPU abort, using the interrupted task frame.
|
* This will make the CPU abort, using the interrupted task frame.
|
||||||
@ -74,7 +74,7 @@ void esp_crosscore_int_send_print_backtrace(int core_id);
|
|||||||
*/
|
*/
|
||||||
void esp_crosscore_int_send_twdt_abort(int core_id);
|
void esp_crosscore_int_send_twdt_abort(int core_id);
|
||||||
|
|
||||||
#endif // CONFIG_ESP_TASK_WDT
|
#endif // CONFIG_ESP_TASK_WDT_EN
|
||||||
#endif // !CONFIG_IDF_TARGET_ESP32C3 && !CONFIG_IDF_TARGET_ESP32H2 && !CONFIG_IDF_TARGET_ESP32C2
|
#endif // !CONFIG_IDF_TARGET_ESP32C3 && !CONFIG_IDF_TARGET_ESP32H2 && !CONFIG_IDF_TARGET_ESP32C2
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
|
|
||||||
#if CONFIG_ESP_TASK_WDT
|
#if CONFIG_ESP_TASK_WDT_EN
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -29,7 +29,7 @@ typedef void (*twdt_isr_callback)(void*);
|
|||||||
/**
|
/**
|
||||||
* @brief Stop the Task Watchdog Timer (TWDT)
|
* @brief Stop the Task Watchdog Timer (TWDT)
|
||||||
*
|
*
|
||||||
* This function will temporarily stop the timer until it is restarted/resumed by a call to esp_task_wdt_restart().
|
* This function will temporarily stop the timer until it is restarted by a call to esp_task_wdt_restart().
|
||||||
|
|
||||||
* @note esp_task_wdt_stop() must not be called by multiple tasks simultaneously.
|
* @note esp_task_wdt_stop() must not be called by multiple tasks simultaneously.
|
||||||
* @return
|
* @return
|
||||||
@ -41,7 +41,7 @@ esp_err_t esp_task_wdt_stop(void);
|
|||||||
/**
|
/**
|
||||||
* @brief Restart the Task Watchdog Timer (TWDT)
|
* @brief Restart the Task Watchdog Timer (TWDT)
|
||||||
*
|
*
|
||||||
* This function will restart/resume the timer after it has been stopped by esp_task_wdt_stop().
|
* This function will restart the timer after it has been stopped by esp_task_wdt_stop().
|
||||||
|
|
||||||
* @note esp_task_wdt_restart() must not be called by multiple tasks simultaneously.
|
* @note esp_task_wdt_restart() must not be called by multiple tasks simultaneously.
|
||||||
* @return
|
* @return
|
||||||
@ -54,4 +54,4 @@ esp_err_t esp_task_wdt_restart(void);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // CONFIG_ESP_TASK_WDT
|
#endif // CONFIG_ESP_TASK_WDT_EN
|
||||||
|
@ -26,6 +26,7 @@ CONFIG_TASK_WDT_PANIC CONFIG_ESP_TASK_WDT_PANI
|
|||||||
CONFIG_TASK_WDT_TIMEOUT_S CONFIG_ESP_TASK_WDT_TIMEOUT_S
|
CONFIG_TASK_WDT_TIMEOUT_S CONFIG_ESP_TASK_WDT_TIMEOUT_S
|
||||||
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0
|
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0
|
||||||
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1 CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1
|
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1 CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1
|
||||||
|
CONFIG_ESP_TASK_WDT CONFIG_ESP_TASK_WDT_INIT
|
||||||
CONFIG_ESP32_DEBUG_STUBS_ENABLE CONFIG_ESP_DEBUG_STUBS_ENABLE
|
CONFIG_ESP32_DEBUG_STUBS_ENABLE CONFIG_ESP_DEBUG_STUBS_ENABLE
|
||||||
|
|
||||||
CONFIG_BROWNOUT_DET CONFIG_ESP_BROWNOUT_DET
|
CONFIG_BROWNOUT_DET CONFIG_ESP_BROWNOUT_DET
|
||||||
|
@ -222,7 +222,7 @@ TEST_CASE_MULTIPLE_STAGES("reset reason ESP_RST_INT_WDT after interrupt watchdog
|
|||||||
do_int_wdt_hw,
|
do_int_wdt_hw,
|
||||||
check_reset_reason_int_wdt);
|
check_reset_reason_int_wdt);
|
||||||
|
|
||||||
#if CONFIG_ESP_TASK_WDT
|
#if CONFIG_ESP_TASK_WDT_EN
|
||||||
static void do_task_wdt(void)
|
static void do_task_wdt(void)
|
||||||
{
|
{
|
||||||
setup_values();
|
setup_values();
|
||||||
@ -252,7 +252,7 @@ TEST_CASE_MULTIPLE_STAGES("reset reason ESP_RST_TASK_WDT after task watchdog",
|
|||||||
"[reset_reason][reset="RESET"]",
|
"[reset_reason][reset="RESET"]",
|
||||||
do_task_wdt,
|
do_task_wdt,
|
||||||
check_reset_reason_task_wdt);
|
check_reset_reason_task_wdt);
|
||||||
#endif // CONFIG_ESP_TASK_WDT
|
#endif // CONFIG_ESP_TASK_WDT_EN
|
||||||
|
|
||||||
static void do_rtc_wdt(void)
|
static void do_rtc_wdt(void)
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
#if CONFIG_ESP_TASK_WDT
|
#if CONFIG_ESP_TASK_WDT_EN
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
@ -153,4 +153,4 @@ TEST_CASE("Task WDT user feed", "[task_wdt]")
|
|||||||
TEST_ASSERT_EQUAL(ESP_OK, esp_task_wdt_deinit());
|
TEST_ASSERT_EQUAL(ESP_OK, esp_task_wdt_deinit());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_ESP_TASK_WDT
|
#endif // CONFIG_ESP_TASK_WDT_EN
|
||||||
|
@ -294,7 +294,7 @@ inline bool esp_core_dump_tcb_addr_is_sane(uint32_t addr)
|
|||||||
|
|
||||||
inline bool esp_core_dump_in_isr_context(void)
|
inline bool esp_core_dump_in_isr_context(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_ESP_TASK_WDT
|
#if CONFIG_ESP_TASK_WDT_EN
|
||||||
/* This function will be used to check whether a panic occurred in an ISR.
|
/* This function will be used to check whether a panic occurred in an ISR.
|
||||||
* In that case, the execution frame must be switch to the interrupt stack.
|
* In that case, the execution frame must be switch to the interrupt stack.
|
||||||
* However, in case where the task watchdog ISR calls the panic handler,
|
* However, in case where the task watchdog ISR calls the panic handler,
|
||||||
@ -304,9 +304,9 @@ inline bool esp_core_dump_in_isr_context(void)
|
|||||||
* TODO: IDF-5694. */
|
* TODO: IDF-5694. */
|
||||||
extern bool g_twdt_isr;
|
extern bool g_twdt_isr;
|
||||||
return xPortInterruptedFromISRContext() && !g_twdt_isr;
|
return xPortInterruptedFromISRContext() && !g_twdt_isr;
|
||||||
#else // CONFIG_ESP_TASK_WDT
|
#else // CONFIG_ESP_TASK_WDT_EN
|
||||||
return xPortInterruptedFromISRContext();
|
return xPortInterruptedFromISRContext();
|
||||||
#endif // CONFIG_ESP_TASK_WDT
|
#endif // CONFIG_ESP_TASK_WDT_EN
|
||||||
}
|
}
|
||||||
|
|
||||||
inline core_dump_task_handle_t esp_core_dump_get_current_task_handle()
|
inline core_dump_task_handle_t esp_core_dump_get_current_task_handle()
|
||||||
|
@ -570,7 +570,7 @@ TEST_CASE("mbedtls RSA Generate Key", "[mbedtls][timeout=60]")
|
|||||||
const unsigned int key_size = 2048;
|
const unsigned int key_size = 2048;
|
||||||
const int exponent = 65537;
|
const int exponent = 65537;
|
||||||
|
|
||||||
#if CONFIG_MBEDTLS_MPI_USE_INTERRUPT && CONFIG_ESP_TASK_WDT && !CONFIG_ESP_TASK_WDT_INIT
|
#if CONFIG_MBEDTLS_MPI_USE_INTERRUPT && CONFIG_ESP_TASK_WDT_EN && !CONFIG_ESP_TASK_WDT_INIT
|
||||||
/* Check that generating keys doesnt starve the watchdog if interrupt-based driver is used */
|
/* Check that generating keys doesnt starve the watchdog if interrupt-based driver is used */
|
||||||
esp_task_wdt_config_t twdt_config = {
|
esp_task_wdt_config_t twdt_config = {
|
||||||
.timeout_ms = 1000,
|
.timeout_ms = 1000,
|
||||||
@ -578,7 +578,7 @@ TEST_CASE("mbedtls RSA Generate Key", "[mbedtls][timeout=60]")
|
|||||||
.trigger_panic = true,
|
.trigger_panic = true,
|
||||||
};
|
};
|
||||||
TEST_ASSERT_EQUAL(ESP_OK, esp_task_wdt_init(&twdt_config));
|
TEST_ASSERT_EQUAL(ESP_OK, esp_task_wdt_init(&twdt_config));
|
||||||
#endif // CONFIG_MBEDTLS_MPI_USE_INTERRUPT && CONFIG_ESP_TASK_WDT && !CONFIG_ESP_TASK_WDT_INIT
|
#endif // CONFIG_MBEDTLS_MPI_USE_INTERRUPT && CONFIG_ESP_TASK_WDT_EN && !CONFIG_ESP_TASK_WDT_INIT
|
||||||
|
|
||||||
mbedtls_rsa_init(&ctx);
|
mbedtls_rsa_init(&ctx);
|
||||||
mbedtls_ctr_drbg_init(&ctr_drbg);
|
mbedtls_ctr_drbg_init(&ctr_drbg);
|
||||||
@ -592,9 +592,9 @@ TEST_CASE("mbedtls RSA Generate Key", "[mbedtls][timeout=60]")
|
|||||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||||
mbedtls_entropy_free(&entropy);
|
mbedtls_entropy_free(&entropy);
|
||||||
|
|
||||||
#if CONFIG_MBEDTLS_MPI_USE_INTERRUPT && CONFIG_ESP_TASK_WDT && !CONFIG_ESP_TASK_WDT_INIT
|
#if CONFIG_MBEDTLS_MPI_USE_INTERRUPT && CONFIG_ESP_TASK_WDT_EN && !CONFIG_ESP_TASK_WDT_INIT
|
||||||
TEST_ASSERT_EQUAL(ESP_OK, esp_task_wdt_deinit());
|
TEST_ASSERT_EQUAL(ESP_OK, esp_task_wdt_deinit());
|
||||||
#endif // CONFIG_MBEDTLS_MPI_USE_INTERRUPT && CONFIG_ESP_TASK_WDT && !CONFIG_ESP_TASK_WDT_INIT
|
#endif // CONFIG_MBEDTLS_MPI_USE_INTERRUPT && CONFIG_ESP_TASK_WDT_EN && !CONFIG_ESP_TASK_WDT_INIT
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ The following config options control TWDT configuration. They are all enabled by
|
|||||||
|
|
||||||
.. list::
|
.. list::
|
||||||
|
|
||||||
- :ref:`CONFIG_ESP_TASK_WDT` - enables TWDT feature. If this option is disabled, TWDT cannot be used, even if initialized at runtime.
|
- :ref:`CONFIG_ESP_TASK_WDT_EN` - enables TWDT feature. If this option is disabled, TWDT cannot be used, even if initialized at runtime.
|
||||||
- :ref:`CONFIG_ESP_TASK_WDT_INIT` - the TWDT is initialized automatically during startup. If this option is disabled, it is still possible to initialize the Task WDT at runtime by calling :cpp:func:`esp_task_wdt_init`.
|
- :ref:`CONFIG_ESP_TASK_WDT_INIT` - the TWDT is initialized automatically during startup. If this option is disabled, it is still possible to initialize the Task WDT at runtime by calling :cpp:func:`esp_task_wdt_init`.
|
||||||
- :ref:`CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0` - {IDF_TARGET_IDLE_TASK} is subscribed to the TWDT during startup. If this option is disabled, it is still possible to subscribe the idle task by calling :cpp:func:`esp_task_wdt_init` again.
|
- :ref:`CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0` - {IDF_TARGET_IDLE_TASK} is subscribed to the TWDT during startup. If this option is disabled, it is still possible to subscribe the idle task by calling :cpp:func:`esp_task_wdt_init` again.
|
||||||
:not CONFIG_FREERTOS_UNICORE: - :ref:`CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1` - CPU1 Idle task is subscribed to the TWDT during startup.
|
:not CONFIG_FREERTOS_UNICORE: - :ref:`CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1` - CPU1 Idle task is subscribed to the TWDT during startup.
|
||||||
|
@ -115,7 +115,7 @@ Task Watchdog Timers
|
|||||||
- Configuration is now passed as a configuration structure.
|
- Configuration is now passed as a configuration structure.
|
||||||
- The function will now handle subscribing of the idle tasks if configured to do so.
|
- The function will now handle subscribing of the idle tasks if configured to do so.
|
||||||
|
|
||||||
- The former :ref:`CONFIG_ESP_TASK_WDT` configuration option has been renamed to :ref:`CONFIG_ESP_TASK_WDT_INIT` and a new :ref:`CONFIG_ESP_TASK_WDT` option has been introduced.
|
- The former ``CONFIG_ESP_TASK_WDT`` configuration option has been renamed to :ref:`CONFIG_ESP_TASK_WDT_INIT` and a new :ref:`CONFIG_ESP_TASK_WDT_EN` option has been introduced.
|
||||||
|
|
||||||
FreeRTOS
|
FreeRTOS
|
||||||
--------
|
--------
|
||||||
|
@ -21,7 +21,7 @@ Before project configuration and build, be sure to set the correct chip target u
|
|||||||
|
|
||||||
### Configure the project
|
### Configure the project
|
||||||
|
|
||||||
Program should run correctly without needing any special configuration. However, users can disable `CONFIG_ESP_TASK_WDT` which will prevent the TWDT from being automatically initialized on startup. If disabled, the example will manually initialize the TWDT.
|
Program should run correctly without needing any special configuration. However, users can disable `CONFIG_ESP_TASK_WDT_INIT` which will prevent the TWDT from being automatically initialized on startup. If disabled, the example will manually initialize the TWDT.
|
||||||
|
|
||||||
### Build and Flash
|
### Build and Flash
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user