Skip to content

Commit 3430ad2

Browse files
wangchdoanchao
authored andcommitted
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.
1 parent 8cfb9d7 commit 3430ad2

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

sched/init/nx_bringup.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@
6565
/* Configuration */
6666

6767
#if defined(CONFIG_INIT_NONE)
68-
/* Kconfig logic will set CONFIG_INIT_NONE if dependencies are not met */
69-
70-
# error No initialization mechanism selected (CONFIG_INIT_NONE)
71-
68+
# ifndef CONFIG_BUILD_FLAT
69+
# error No initialization mechanism selected (CONFIG_INIT_NONE)
70+
# endif
7271
#else
7372
# if !defined(CONFIG_INIT_ENTRY) && !defined(CONFIG_INIT_FILE)
7473
/* For backward compatibility with older defconfig files when this was
@@ -326,6 +325,14 @@ static inline void nx_start_application(void)
326325
coredump_initialize();
327326
#endif
328327

328+
#ifdef CONFIG_INIT_NONE
329+
330+
UNUSED(ret);
331+
332+
/* In a flat build, init thread is not mandatory */
333+
334+
sinfo("No init thread\n");
335+
#else
329336
posix_spawnattr_init(&attr);
330337
attr.priority = CONFIG_INIT_PRIORITY;
331338
attr.stacksize = CONFIG_INIT_STACKSIZE;
@@ -378,6 +385,7 @@ static inline void nx_start_application(void)
378385
#endif
379386
posix_spawnattr_destroy(&attr);
380387
DEBUGASSERT(ret > 0);
388+
#endif /* CONFIG_INIT_NONE */
381389
}
382390

383391
/****************************************************************************

0 commit comments

Comments
 (0)