diff --git a/include/nuttx/init.h b/include/nuttx/init.h index af3dce335f6ee..1db060b53b372 100644 --- a/include/nuttx/init.h +++ b/include/nuttx/init.h @@ -38,6 +38,7 @@ * initialization. */ +#define OSINIT_TASK_READY() (g_nx_initstate >= OSINIT_TASKLISTS) #define OSINIT_MM_READY() (g_nx_initstate >= OSINIT_MEMORY) #define OSINIT_HW_READY() (g_nx_initstate >= OSINIT_HARDWARE) #define OSINIT_OS_READY() (g_nx_initstate >= OSINIT_OSREADY) diff --git a/sched/sched/sched_idletask.c b/sched/sched/sched_idletask.c index a402a2b39a3dc..cdf6cb3de21ae 100644 --- a/sched/sched/sched_idletask.c +++ b/sched/sched/sched_idletask.c @@ -62,7 +62,7 @@ bool sched_idletask(void) * have been initialized and, in that case, rtcb may be NULL. */ - DEBUGASSERT(rtcb != NULL || g_nx_initstate < OSINIT_TASKLISTS); + DEBUGASSERT(rtcb != NULL || !OSINIT_TASK_READY()); if (rtcb != NULL) { /* The IDLE task TCB is distinguishable by a few things: