diff --git a/sched/Kconfig b/sched/Kconfig index 5843b34497..1f94a0f3ec 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -347,6 +347,10 @@ config INIT_ENTRYPOINT applications this is of the form 'app_main' where 'app' is the application name. If not defined, INIT_ENTRYPOINT defaults to "main". +config INIT_ENTRYNAME + string "Application entry name" + default INIT_ENTRYPOINT + endif # INIT_ENTRY if INIT_FILE diff --git a/sched/init/nx_bringup.c b/sched/init/nx_bringup.c index 99c94c2359..8ec1d743d7 100644 --- a/sched/init/nx_bringup.c +++ b/sched/init/nx_bringup.c @@ -234,6 +234,9 @@ static inline void nx_start_application(void) FAR char *const *argv = NULL; #endif int ret; +#ifdef CONFIG_INIT_FILE + posix_spawnattr_t attr; +#endif #ifdef CONFIG_BOARD_LATE_INITIALIZE /* Perform any last-minute, board-specific initialization, if so @@ -255,11 +258,11 @@ static inline void nx_start_application(void) #ifdef CONFIG_BUILD_PROTECTED DEBUGASSERT(USERSPACE->us_entrypoint != NULL); - ret = nxtask_create("init", CONFIG_INIT_PRIORITY, + ret = nxtask_create(CONFIG_INIT_ENTRYNAME, CONFIG_INIT_PRIORITY, CONFIG_INIT_STACKSIZE, USERSPACE->us_entrypoint, argv); #else - ret = nxtask_create("init", CONFIG_INIT_PRIORITY, + ret = nxtask_create(CONFIG_INIT_ENTRYNAME, CONFIG_INIT_PRIORITY, CONFIG_INIT_STACKSIZE, (main_t)CONFIG_INIT_ENTRYPOINT, argv); #endif @@ -283,8 +286,14 @@ static inline void nx_start_application(void) sinfo("Starting init task: %s\n", CONFIG_INIT_FILEPATH); - ret = exec(CONFIG_INIT_FILEPATH, argv, - CONFIG_INIT_SYMTAB, CONFIG_INIT_NEXPORTS); + posix_spawnattr_init(&attr); + + attr.priority = CONFIG_INIT_PRIORITY; +#ifndef CONFIG_ARCH_ADDRENV + attr.stacksize = CONFIG_INIT_STACKSIZE; +#endif + ret = exec_spawn(CONFIG_INIT_FILEPATH, argv, + CONFIG_INIT_SYMTAB, CONFIG_INIT_NEXPORTS, &attr); DEBUGASSERT(ret >= 0); #endif