TWDT: the Kconfig option ESP_TASK_WDT_EN is now used to enable Task Watchdog

This commit is contained in:
Omar Chebib 2022-08-23 17:58:14 +08:00
parent 30d12af191
commit 6798bfc4b0
13 changed files with 29 additions and 28 deletions

View File

@ -25,7 +25,7 @@ else()
"xt_wdt.c"
"debug_stubs.c")
if(CONFIG_ESP_TASK_WDT)
if(CONFIG_ESP_TASK_WDT_EN)
list(APPEND srcs "task_wdt/task_wdt.c")
if(CONFIG_ESP_TASK_WDT_USE_ESP_TIMER)

View File

@ -393,7 +393,7 @@ menu "ESP System Settings"
help
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"
default y
select FREERTOS_ENABLE_TASK_SNAPSHOT
@ -407,14 +407,14 @@ menu "ESP System Settings"
# Software implementation of Task Watchdog, handy for targets with only a single
# Timer Group, such as the ESP32-C2
bool
depends on ESP_TASK_WDT
depends on ESP_TASK_WDT_EN
default y if IDF_TARGET_ESP32C2
default n if !IDF_TARGET_ESP32C2
select ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD
config ESP_TASK_WDT_INIT
bool "Initialize Task Watchdog Timer on startup"
depends on ESP_TASK_WDT
depends on ESP_TASK_WDT_EN
default y
help
Enabling this option will cause the Task Watchdog Timer to be initialized

View File

@ -96,14 +96,14 @@ static void IRAM_ATTR esp_crosscore_isr(void *arg) {
esp_backtrace_print(100);
}
#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
if (my_reason_val & REASON_TWDT_ABORT) {
extern void task_wdt_timeout_abort_xtensa(bool);
/* Called from a crosscore interrupt, thus, we are not the core that received
* the TWDT interrupt, call the function with `false` as a parameter. */
task_wdt_timeout_abort_xtensa(false);
}
#endif // CONFIG_ESP_TASK_WDT
#endif // CONFIG_ESP_TASK_WDT_EN
#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);
}
#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
void IRAM_ATTR esp_crosscore_int_send_twdt_abort(int core_id) {
esp_crosscore_int_send(core_id, REASON_TWDT_ABORT);
}
#endif // CONFIG_ESP_TASK_WDT
#endif // CONFIG_ESP_TASK_WDT_EN
#endif

View File

@ -61,7 +61,7 @@ void esp_crosscore_int_send_gdb_call(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`.
* 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);
#endif // CONFIG_ESP_TASK_WDT
#endif // CONFIG_ESP_TASK_WDT_EN
#endif // !CONFIG_IDF_TARGET_ESP32C3 && !CONFIG_IDF_TARGET_ESP32H2 && !CONFIG_IDF_TARGET_ESP32C2
#ifdef __cplusplus

View File

@ -9,7 +9,7 @@
#include "sdkconfig.h"
#include "esp_err.h"
#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
#ifdef __cplusplus
extern "C" {
@ -29,7 +29,7 @@ typedef void (*twdt_isr_callback)(void*);
/**
* @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.
* @return
@ -41,7 +41,7 @@ esp_err_t esp_task_wdt_stop(void);
/**
* @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.
* @return
@ -54,4 +54,4 @@ esp_err_t esp_task_wdt_restart(void);
}
#endif
#endif // CONFIG_ESP_TASK_WDT
#endif // CONFIG_ESP_TASK_WDT_EN

View File

@ -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_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_ESP_TASK_WDT CONFIG_ESP_TASK_WDT_INIT
CONFIG_ESP32_DEBUG_STUBS_ENABLE CONFIG_ESP_DEBUG_STUBS_ENABLE
CONFIG_BROWNOUT_DET CONFIG_ESP_BROWNOUT_DET

View File

@ -222,7 +222,7 @@ TEST_CASE_MULTIPLE_STAGES("reset reason ESP_RST_INT_WDT after interrupt watchdog
do_int_wdt_hw,
check_reset_reason_int_wdt);
#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
static void do_task_wdt(void)
{
setup_values();
@ -252,7 +252,7 @@ TEST_CASE_MULTIPLE_STAGES("reset reason ESP_RST_TASK_WDT after task watchdog",
"[reset_reason][reset="RESET"]",
do_task_wdt,
check_reset_reason_task_wdt);
#endif // CONFIG_ESP_TASK_WDT
#endif // CONFIG_ESP_TASK_WDT_EN
static void do_rtc_wdt(void)
{

View File

@ -6,7 +6,7 @@
#include "sdkconfig.h"
#if CONFIG_ESP_TASK_WDT
#if CONFIG_ESP_TASK_WDT_EN
#include <stdbool.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());
}
#endif // CONFIG_ESP_TASK_WDT
#endif // CONFIG_ESP_TASK_WDT_EN

View File

@ -286,7 +286,7 @@ inline bool esp_core_dump_tcb_addr_is_sane(uint32_t addr)
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.
* 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,
@ -296,9 +296,9 @@ inline bool esp_core_dump_in_isr_context(void)
* TODO: IDF-5694. */
extern bool g_twdt_isr;
return xPortInterruptedFromISRContext() && !g_twdt_isr;
#else // CONFIG_ESP_TASK_WDT
#else // CONFIG_ESP_TASK_WDT_EN
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()

View File

@ -570,7 +570,7 @@ TEST_CASE("mbedtls RSA Generate Key", "[mbedtls][timeout=60]")
const unsigned int key_size = 2048;
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 */
esp_task_wdt_config_t twdt_config = {
.timeout_ms = 1000,
@ -578,7 +578,7 @@ TEST_CASE("mbedtls RSA Generate Key", "[mbedtls][timeout=60]")
.trigger_panic = true,
};
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_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_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());
#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
}

View File

@ -107,7 +107,7 @@ The following config options control TWDT configuration. They are all enabled by
.. 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_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.

View File

@ -115,7 +115,7 @@ Task Watchdog Timers
- Configuration is now passed as a configuration structure.
- 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
--------

View File

@ -21,7 +21,7 @@ Before project configuration and build, be sure to set the correct chip target u
### 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