“Semaphores/mutexes should never be used before nxsem_initialize() is called. Otherwise you would be using the semaphore subsystem before it has been initialized.. So either (1) up_nputs() must not use semaphores or (2) up_nputs() must not be used prior to calling nxsem_initialize(). There is a global variable g_nx_init_state that can also be used to check where nx_start is in the initialization sequence.”

“As a general rule, we should not use semaphores or mutexes on the IDLE thread. The IDLE thread is the thread that runs when you boot up the system. All initialization is performed on the IDLE thread, hence, it is sometimes called the initialization thread.”

These are Gregory Nutt’s comments from: https://github.com/apache/nuttx/pull/9404