From b82ad5c495d5b7830059df2fef80847a1d39c032 Mon Sep 17 00:00:00 2001 From: yukangzhi Date: Wed, 21 Jan 2026 13:34:32 +0800 Subject: [PATCH] arch/tricore: disable CPU and system watchdogs during startup Some Aurix Boot-FW configurations leave watchdogs enabled by default, which can cause unexpected resets during early bring-up. This change explicitly disables the CPU and system watchdogs during core0 startup to ensure reliable system initialization. - For TC3XX chips, call `IfxScuWdt_disableCpuWatchdog()` and `IfxScuWdt_disableSafetyWatchdog()`. - For TC4XX chips, call `IfxWtu_disableCpuWatchdog()` and `IfxWtu_disableSystemWatchdog()`. This is a low-risk startup change and does not alter watchdog behavior after system initialization. Signed-off-by: yukangzhi --- arch/tricore/src/common/tricore_main.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/arch/tricore/src/common/tricore_main.c b/arch/tricore/src/common/tricore_main.c index 17181c99591..2d6708b7e30 100644 --- a/arch/tricore/src/common/tricore_main.c +++ b/arch/tricore/src/common/tricore_main.c @@ -28,8 +28,8 @@ #include #include "Ifx_Types.h" -#include "IfxScuWdt.h" #include "IfxCpu.h" +#include "IfxScuWdt.h" /**************************************************************************** * Private Functions @@ -43,9 +43,6 @@ static void core_main(void) * Enable the watchdogs and service them periodically if it is required */ - IfxScuWdt_disableCpuWatchdog(IfxScuWdt_getCpuWatchdogPassword()); - IfxScuWdt_disableSafetyWatchdog(IfxScuWdt_getSafetyWatchdogPassword()); - /* Wait for CPU sync event */ IfxCpu_emitEvent(&g_sync_event); @@ -66,6 +63,19 @@ static void core_main(void) void core0_main(void) { + /* All WDTs except WDTCPU0 and system watchdog WDTSYS are in + * disabled mode after Boot-FW execution. Disable the watchdog + * to ensure the normal startup of the system. + */ + +#if defined(CONFIG_ARCH_CHIP_AURIX_TC3XX) + IfxScuWdt_disableCpuWatchdog(IfxScuWdt_getCpuWatchdogPassword()); + IfxScuWdt_disableSafetyWatchdog(IfxScuWdt_getSafetyWatchdogPassword()); +#elif defined(CONFIG_ARCH_CHIP_AURIX_TC4XX) + IfxWtu_disableCpuWatchdog(IfxWtu_getCpuWatchdogPassword()); + IfxWtu_disableSystemWatchdog(IfxWtu_getSystemWatchdogPassword()); +#endif + core_main(); }