diff --git a/components/esp_common/CMakeLists.txt b/components/esp_common/CMakeLists.txt index c93f3e5310..d78ffdda90 100644 --- a/components/esp_common/CMakeLists.txt +++ b/components/esp_common/CMakeLists.txt @@ -13,9 +13,7 @@ else() "src/esp_err.c" "src/esp_err_to_name.c" "src/freertos_hooks.c" - "src/stack_check.c" - "src/task_wdt.c" - "src/int_wdt.c") + "src/stack_check.c") # Note: esp_ipc, esp_pm added as a public requirement to keep compatibility as to be located here. idf_component_register(SRCS "${srcs}" diff --git a/components/esp_common/Kconfig b/components/esp_common/Kconfig index 88d983ecfc..0e4fdd4a46 100644 --- a/components/esp_common/Kconfig +++ b/components/esp_common/Kconfig @@ -193,77 +193,6 @@ menu "Common ESP-related" If enabled, esp_rom_printf and ESP_EARLY_LOG output will also be sent over USB CDC. Disabling this option saves about 1kB or RAM. - config ESP_INT_WDT - bool "Interrupt watchdog" - default y - help - This watchdog timer can detect if the FreeRTOS tick interrupt has not been called for a certain time, - either because a task turned off interrupts and did not turn them on for a long time, or because an - interrupt handler did not return. It will try to invoke the panic handler first and failing that - reset the SoC. - - config ESP_INT_WDT_TIMEOUT_MS - int "Interrupt watchdog timeout (ms)" - depends on ESP_INT_WDT - default 300 if !ESP32_SPIRAM_SUPPORT - default 800 if ESP32_SPIRAM_SUPPORT - range 10 10000 - help - The timeout of the watchdog, in miliseconds. Make this higher than the FreeRTOS tick rate. - - config ESP_INT_WDT_CHECK_CPU1 - bool "Also watch CPU1 tick interrupt" - depends on ESP_INT_WDT && !FREERTOS_UNICORE - default y - help - Also detect if interrupts on CPU 1 are disabled for too long. - - config ESP_TASK_WDT - bool "Initialize Task Watchdog Timer on startup" - default y - help - The Task Watchdog Timer can be used to make sure individual tasks are still - running. Enabling this option will cause the Task Watchdog Timer to be - initialized automatically at startup. The Task Watchdog timer can be - initialized after startup as well (see Task Watchdog Timer API Reference) - - config ESP_TASK_WDT_PANIC - bool "Invoke panic handler on Task Watchdog timeout" - depends on ESP_TASK_WDT - default n - help - If this option is enabled, the Task Watchdog Timer will be configured to - trigger the panic handler when it times out. This can also be configured - at run time (see Task Watchdog Timer API Reference) - - config ESP_TASK_WDT_TIMEOUT_S - int "Task Watchdog timeout period (seconds)" - depends on ESP_TASK_WDT - range 1 60 - default 5 - help - Timeout period configuration for the Task Watchdog Timer in seconds. - This is also configurable at run time (see Task Watchdog Timer API Reference) - - config ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 - bool "Watch CPU0 Idle Task" - depends on ESP_TASK_WDT - default y - help - If this option is enabled, the Task Watchdog Timer will watch the CPU0 - Idle Task. Having the Task Watchdog watch the Idle Task allows for detection - of CPU starvation as the Idle Task not being called is usually a symptom of - CPU starvation. Starvation of the Idle Task is detrimental as FreeRTOS household - tasks depend on the Idle Task getting some runtime every now and then. - - config ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 - bool "Watch CPU1 Idle Task" - depends on ESP_TASK_WDT && !FREERTOS_UNICORE - default y - help - If this option is enabled, the Task Wtachdog Timer will wach the CPU1 - Idle Task. - config ESP_PANIC_HANDLER_IRAM bool "Place panic handler code in IRAM" default n diff --git a/components/esp_common/sdkconfig.rename b/components/esp_common/sdkconfig.rename index 5096f42755..419f6206a5 100644 --- a/components/esp_common/sdkconfig.rename +++ b/components/esp_common/sdkconfig.rename @@ -16,14 +16,5 @@ CONFIG_CONSOLE_UART_CUSTOM_NUM_1 CONFIG_ESP_CONSOLE_UART_ CONFIG_CONSOLE_UART_TX_GPIO CONFIG_ESP_CONSOLE_UART_TX_GPIO CONFIG_CONSOLE_UART_RX_GPIO CONFIG_ESP_CONSOLE_UART_RX_GPIO CONFIG_CONSOLE_UART_BAUDRATE CONFIG_ESP_CONSOLE_UART_BAUDRATE -CONFIG_INT_WDT CONFIG_ESP_INT_WDT -CONFIG_INT_WDT_TIMEOUT_MS CONFIG_ESP_INT_WDT_TIMEOUT_MS -CONFIG_INT_WDT_CHECK_CPU1 CONFIG_ESP_INT_WDT_CHECK_CPU1 -CONFIG_TASK_WDT CONFIG_ESP_TASK_WDT -CONFIG_TASK_WDT_PANIC CONFIG_ESP_TASK_WDT_PANIC -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_ESP32_DEBUG_STUBS_ENABLE CONFIG_ESP_DEBUG_STUBS_ENABLE CONFIG_ESP32_ALLOW_RTC_FAST_MEM_AS_HEAP CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP diff --git a/components/esp_pm/linker.lf b/components/esp_pm/linker.lf index e4c4b2f9a5..7bb7d05089 100644 --- a/components/esp_pm/linker.lf +++ b/components/esp_pm/linker.lf @@ -12,11 +12,6 @@ archive: libesp_common.a entries: if PM_RTOS_IDLE_OPT = y: freertos_hooks:esp_vApplicationIdleHook (noflash) - task_wdt:idle_hook_cb (noflash) - task_wdt:esp_task_wdt_reset (noflash) - task_wdt:find_task_in_twdt_list (noflash) - task_wdt:reset_hw_timer (noflash) - [mapping:esp_hw_support_pm] archive: libesp_hw_support.a entries: @@ -31,6 +26,10 @@ entries: sleep_modes:esp_sleep_enable_timer_wakeup (noflash) sleep_modes:timer_wakeup_prepare (noflash) sleep_modes:get_power_down_flags (noflash) + task_wdt:idle_hook_cb (noflash) + task_wdt:esp_task_wdt_reset (noflash) + task_wdt:find_task_in_twdt_list (noflash) + task_wdt:reset_hw_timer (noflash) [mapping:esp_timer_pm] archive: libesp_timer.a diff --git a/components/esp_system/CMakeLists.txt b/components/esp_system/CMakeLists.txt index ba06c0df28..621eeaee2d 100644 --- a/components/esp_system/CMakeLists.txt +++ b/components/esp_system/CMakeLists.txt @@ -12,7 +12,9 @@ set(srcs "intr_alloc.c" "system_api.c" "startup.c" "system_time.c" - "sleep_modes.c") + "sleep_modes.c" + "task_wdt.c" + "int_wdt.c") if(NOT (${target} STREQUAL "esp32c3") ) list(APPEND srcs "dbg_stubs.c") diff --git a/components/esp_common/include/esp_int_wdt.h b/components/esp_system/include/esp_int_wdt.h similarity index 100% rename from components/esp_common/include/esp_int_wdt.h rename to components/esp_system/include/esp_int_wdt.h diff --git a/components/esp_common/include/esp_task_wdt.h b/components/esp_system/include/esp_task_wdt.h similarity index 100% rename from components/esp_common/include/esp_task_wdt.h rename to components/esp_system/include/esp_task_wdt.h diff --git a/components/esp_common/src/int_wdt.c b/components/esp_system/int_wdt.c similarity index 100% rename from components/esp_common/src/int_wdt.c rename to components/esp_system/int_wdt.c diff --git a/components/esp_system/sdkconfig.rename b/components/esp_system/sdkconfig.rename index cd834310c2..5ff5eecc74 100644 --- a/components/esp_system/sdkconfig.rename +++ b/components/esp_system/sdkconfig.rename @@ -16,4 +16,12 @@ CONFIG_ESP32C3_MEMPROT_FEATURE CONFIG_ESP_SYSTEM_MEMPRO CONFIG_ESP32C3_MEMPROT_FEATURE_LOCK CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK CONFIG_ESP32_RTC_XTAL_BOOTSTRAP_CYCLES CONFIG_ESP_SYSTEM_RTC_EXT_XTAL_BOOTSTRAP_CYCLES +CONFIG_INT_WDT CONFIG_ESP_INT_WDT +CONFIG_INT_WDT_TIMEOUT_MS CONFIG_ESP_INT_WDT_TIMEOUT_MS +CONFIG_INT_WDT_CHECK_CPU1 CONFIG_ESP_INT_WDT_CHECK_CPU1 +CONFIG_TASK_WDT CONFIG_ESP_TASK_WDT +CONFIG_TASK_WDT_PANIC CONFIG_ESP_TASK_WDT_PANIC +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_ESP32_DEBUG_STUBS_ENABLE CONFIG_ESP_DEBUG_STUBS_ENABLE diff --git a/components/esp_common/src/task_wdt.c b/components/esp_system/task_wdt.c similarity index 99% rename from components/esp_common/src/task_wdt.c rename to components/esp_system/task_wdt.c index 5c73e20774..27a68a5b15 100644 --- a/components/esp_common/src/task_wdt.c +++ b/components/esp_system/task_wdt.c @@ -164,7 +164,9 @@ static void task_wdt_isr(void *arg) for (twdttask=twdt_config->list; twdttask!=NULL; twdttask=twdttask->next) { if (!twdttask->has_reset) { cpu=xTaskGetAffinity(twdttask->task_handle)==0?DRAM_STR("CPU 0"):DRAM_STR("CPU 1"); - if (xTaskGetAffinity(twdttask->task_handle)==tskNO_AFFINITY) cpu=DRAM_STR("CPU 0/1"); + if (xTaskGetAffinity(twdttask->task_handle)==tskNO_AFFINITY) { + cpu=DRAM_STR("CPU 0/1"); + } ESP_EARLY_LOGE(TAG, " - %s (%s)", pcTaskGetTaskName(twdttask->task_handle), cpu); } }