From 1a73226fed74adba0b57af927919cd83f7613df0 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 2 Oct 2025 14:06:04 +0200 Subject: [PATCH] fw/main: pause task watchdog during initialization Under certain circumstances (still not fully understood), initialization performed in prv_main_task_init() can make task watchdog to trigger as some other tasks (e.g. KernelBG) end up blocked for a long period of time (>6s). This can cause a crash loop, making system unbootable. Instead, pause the task watchdog for a certain period of time. HW watchdog will still be kicked. If for whatever reason init takes > 30s, task watchdog will become active again and will eventually kick us out. Signed-off-by: Gerard Marull-Paretas --- src/fw/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fw/main.c b/src/fw/main.c index c9b4bdea..d9420afe 100644 --- a/src/fw/main.c +++ b/src/fw/main.c @@ -409,7 +409,13 @@ static NOINLINE void prv_main_task_init(void) { new_timer_service_init(); regular_timer_init(); clock_init(); + + // Initialize the task watchdog and immediately pause it for 30 seconds to + // give us time to initialize everything without worrying about task watchdog + // from firing if we block other tasks. task_watchdog_init(); + task_watchdog_pause(30); + analytics_init(); register_system_timers(); system_task_timer_init(); @@ -499,6 +505,8 @@ static NOINLINE void prv_main_task_init(void) { // Test setjmp/longjmp prv_test_sjlj(); #endif + + task_watchdog_resume(); } static void main_task(void *parameter) {