sched/init/nx_bringup.c: Add support for CONFIG_INIT_NONE in a flat build

In a flat build, a separate init thread should not be mandatory,
users can create a user task in the board early initialization or late initialization hook.
This commit is contained in:
wangchengdong 2025-08-27 19:42:21 +08:00 committed by archer
parent 8cfb9d7053
commit 3430ad2e1c

View file

@ -65,10 +65,9 @@
/* Configuration */
#if defined(CONFIG_INIT_NONE)
/* Kconfig logic will set CONFIG_INIT_NONE if dependencies are not met */
# ifndef CONFIG_BUILD_FLAT
# error No initialization mechanism selected (CONFIG_INIT_NONE)
# endif
#else
# if !defined(CONFIG_INIT_ENTRY) && !defined(CONFIG_INIT_FILE)
/* For backward compatibility with older defconfig files when this was
@ -326,6 +325,14 @@ static inline void nx_start_application(void)
coredump_initialize();
#endif
#ifdef CONFIG_INIT_NONE
UNUSED(ret);
/* In a flat build, init thread is not mandatory */
sinfo("No init thread\n");
#else
posix_spawnattr_init(&attr);
attr.priority = CONFIG_INIT_PRIORITY;
attr.stacksize = CONFIG_INIT_STACKSIZE;
@ -378,6 +385,7 @@ static inline void nx_start_application(void)
#endif
posix_spawnattr_destroy(&attr);
DEBUGASSERT(ret > 0);
#endif /* CONFIG_INIT_NONE */
}
/****************************************************************************