refactor(system): guard WDT with SoC capability macros

Wrap MWDT-related code under SOC_WDT_SUPPORTED so targets without a main
watchdog can compile.

Add SOC_RTC_WDT_SUPPORTED for RTC watchdog usage (bootloader, slow-clock
paths) and regenerate Kconfig.soc_caps.in. Bootloader RWDT setup stays
under SOC_RTC_WDT_SUPPORTED; MWDT flashboot teardown stays under
SOC_WDT_SUPPORTED.

ESP_INT_WDT, ESP_TASK_WDT_EN, and BOOTLOADER_WDT_ENABLE depend on
SOC_WDT_SUPPORTED where applicable. Build xt_wdt.c only when
SOC_XT_WDT_SUPPORTED. Provide no-op panic WDT helpers when
SOC_WDT_SUPPORTED is disabled.
This commit is contained in:
Meet Patel
2026-03-24 14:57:43 +05:30
parent a02fd7e33b
commit c4e2fe2c8b
76 changed files with 495 additions and 83 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -18,6 +18,8 @@
#include "soc/assist_debug_reg.h"
#include "esp_cpu.h"
#include "soc/rtc.h"
#include "soc/soc_caps.h"
#include "soc/extmem_reg.h"
#include "soc/pcr_reg.h"
#include "esp32c6/rom/ets_sys.h"
@@ -46,6 +48,7 @@
ESP_LOG_ATTR_TAG(TAG, "boot.esp32c6");
#if SOC_RTC_WDT_SUPPORTED
static void wdt_reset_cpu0_info_enable(void)
{
REG_SET_BIT(PCR_ASSIST_CONF_REG, PCR_ASSIST_CLK_EN);
@@ -82,6 +85,7 @@ static void bootloader_super_wdt_auto_feed(void)
REG_SET_BIT(LP_WDT_SWD_CONFIG_REG, LP_WDT_SWD_AUTO_FEED_EN);
REG_WRITE(LP_WDT_SWD_WPROTECT_REG, 0);
}
#endif // SOC_RTC_WDT_SUPPORTED
static inline void bootloader_hardware_init(void)
{
@@ -112,7 +116,9 @@ esp_err_t bootloader_init(void)
bootloader_hardware_init();
bootloader_ana_reset_config();
#if SOC_RTC_WDT_SUPPORTED
bootloader_super_wdt_auto_feed();
#endif
// In RAM_APP, memory will be initialized in `call_start_cpu0`
#if !CONFIG_APP_BUILD_TYPE_RAM
@@ -163,10 +169,14 @@ esp_err_t bootloader_init(void)
}
#endif // !CONFIG_APP_BUILD_TYPE_RAM
#if SOC_RTC_WDT_SUPPORTED
// check whether a WDT reset happened
bootloader_check_wdt_reset();
#endif
#if SOC_RTC_WDT_SUPPORTED || SOC_WDT_SUPPORTED
// config WDT
bootloader_config_wdt();
#endif
// enable RNG early entropy source
bootloader_enable_random();