Launch the initial task through task_spawn instead of nxtask_create
to share the code with the code path of posix_spawn Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
926e296d48
commit
1280a2a8f9
@ -1604,21 +1604,20 @@ static void uart_launch_worker(void *arg)
|
|||||||
nxsched_foreach(uart_launch_foreach, &found);
|
nxsched_foreach(uart_launch_foreach, &found);
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_TTY_LAUNCH_ENTRY
|
|
||||||
nxtask_create(CONFIG_TTY_LAUNCH_ENTRYNAME,
|
|
||||||
CONFIG_TTY_LAUNCH_PRIORITY,
|
|
||||||
NULL, CONFIG_TTY_LAUNCH_STACKSIZE,
|
|
||||||
CONFIG_TTY_LAUNCH_ENTRYPOINT,
|
|
||||||
argv, NULL);
|
|
||||||
#else
|
|
||||||
posix_spawnattr_t attr;
|
posix_spawnattr_t attr;
|
||||||
|
|
||||||
posix_spawnattr_init(&attr);
|
posix_spawnattr_init(&attr);
|
||||||
|
|
||||||
attr.priority = CONFIG_TTY_LAUNCH_PRIORITY;
|
attr.priority = CONFIG_TTY_LAUNCH_PRIORITY;
|
||||||
attr.stacksize = CONFIG_TTY_LAUNCH_STACKSIZE;
|
attr.stacksize = CONFIG_TTY_LAUNCH_STACKSIZE;
|
||||||
exec_spawn(CONFIG_TTY_LAUNCH_FILEPATH, argv, NULL, 0, &attr);
|
|
||||||
|
#ifdef CONFIG_TTY_LAUNCH_ENTRY
|
||||||
|
task_spawn(CONFIG_TTY_LAUNCH_ENTRYNAME,
|
||||||
|
CONFIG_TTY_LAUNCH_ENTRYPOINT,
|
||||||
|
NULL, &attr, argv, NULL);
|
||||||
|
#else
|
||||||
|
exec_spawn(CONFIG_TTY_LAUNCH_FILEPATH, argv, NULL, NULL, 0, &attr);
|
||||||
#endif
|
#endif
|
||||||
|
posix_spawnattr_destroy(&attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,9 +234,7 @@ static inline void nx_start_application(void)
|
|||||||
# endif
|
# endif
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_INIT_FILE
|
|
||||||
posix_spawnattr_t attr;
|
posix_spawnattr_t attr;
|
||||||
#endif
|
#endif
|
||||||
int ret;
|
int ret;
|
||||||
@ -249,6 +247,10 @@ static inline void nx_start_application(void)
|
|||||||
board_late_initialize();
|
board_late_initialize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
posix_spawnattr_init(&attr);
|
||||||
|
attr.priority = CONFIG_INIT_PRIORITY;
|
||||||
|
attr.stacksize = CONFIG_INIT_STACKSIZE;
|
||||||
|
|
||||||
#if defined(CONFIG_INIT_ENTRY)
|
#if defined(CONFIG_INIT_ENTRY)
|
||||||
|
|
||||||
/* Start the application initialization task. In a flat build, this is
|
/* Start the application initialization task. In a flat build, this is
|
||||||
@ -261,16 +263,14 @@ static inline void nx_start_application(void)
|
|||||||
|
|
||||||
# ifdef CONFIG_BUILD_PROTECTED
|
# ifdef CONFIG_BUILD_PROTECTED
|
||||||
DEBUGASSERT(USERSPACE->us_entrypoint != NULL);
|
DEBUGASSERT(USERSPACE->us_entrypoint != NULL);
|
||||||
ret = nxtask_create(CONFIG_INIT_ENTRYNAME, CONFIG_INIT_PRIORITY,
|
ret = task_spawn(CONFIG_INIT_ENTRYNAME,
|
||||||
NULL, CONFIG_INIT_STACKSIZE,
|
USERSPACE->us_entrypoint,
|
||||||
USERSPACE->us_entrypoint, argv, NULL);
|
NULL, &attr, argv, NULL);
|
||||||
# else
|
# else
|
||||||
ret = nxtask_create(CONFIG_INIT_ENTRYNAME, CONFIG_INIT_PRIORITY,
|
ret = task_spawn(CONFIG_INIT_ENTRYNAME,
|
||||||
NULL, CONFIG_INIT_STACKSIZE,
|
CONFIG_INIT_ENTRYPOINT,
|
||||||
CONFIG_INIT_ENTRYPOINT, argv, NULL);
|
NULL, &attr, argv, NULL);
|
||||||
# endif
|
# endif
|
||||||
DEBUGASSERT(ret > 0);
|
|
||||||
|
|
||||||
#elif defined(CONFIG_INIT_FILE)
|
#elif defined(CONFIG_INIT_FILE)
|
||||||
|
|
||||||
# ifdef CONFIG_INIT_MOUNT
|
# ifdef CONFIG_INIT_MOUNT
|
||||||
@ -296,10 +296,9 @@ static inline void nx_start_application(void)
|
|||||||
|
|
||||||
ret = exec_spawn(CONFIG_INIT_FILEPATH, argv, NULL,
|
ret = exec_spawn(CONFIG_INIT_FILEPATH, argv, NULL,
|
||||||
CONFIG_INIT_SYMTAB, CONFIG_INIT_NEXPORTS, &attr);
|
CONFIG_INIT_SYMTAB, CONFIG_INIT_NEXPORTS, &attr);
|
||||||
DEBUGASSERT(ret >= 0);
|
|
||||||
#endif
|
#endif
|
||||||
|
posix_spawnattr_destroy(&attr);
|
||||||
UNUSED(ret);
|
DEBUGASSERT(ret > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user