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 <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2025-10-02 14:06:04 +02:00 committed by Jinchang
parent 4051c5bb97
commit 1a73226fed
1 changed files with 8 additions and 0 deletions

View File

@ -409,7 +409,13 @@ static NOINLINE void prv_main_task_init(void) {
new_timer_service_init(); new_timer_service_init();
regular_timer_init(); regular_timer_init();
clock_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_init();
task_watchdog_pause(30);
analytics_init(); analytics_init();
register_system_timers(); register_system_timers();
system_task_timer_init(); system_task_timer_init();
@ -499,6 +505,8 @@ static NOINLINE void prv_main_task_init(void) {
// Test setjmp/longjmp // Test setjmp/longjmp
prv_test_sjlj(); prv_test_sjlj();
#endif #endif
task_watchdog_resume();
} }
static void main_task(void *parameter) { static void main_task(void *parameter) {