init: move USERMAIN_XX out of INIT_ENTRYPOINT

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2021-12-20 12:21:47 +08:00 committed by Xiang Xiao
parent 36389dab76
commit 10ccba6671
8 changed files with 52 additions and 52 deletions

View File

@ -14,11 +14,11 @@ increasing difficulty:
#. You replace the sample code at ``apps/examples/nsh/nsh_main.c`` with
whatever start-up logic that you want. NSH is a library at
``apps/nshlib``. ``apps.examples/nsh`` is just a tiny, example
start-up function (``CONFIG_USER_ENTRYPOINT``\ ()) that that runs
start-up function (``CONFIG_INIT_ENTRYPOINT``\ ()) that runs
immediately and illustrates how to start NSH If you want something
else to run immediately then you can write your write your own custom
``CONFIG_USER_ENTRYPOINT``\ () function and then start other tasks
from your custom ``CONFIG_USER_ENTRYPOINT``\ ().
``CONFIG_INIT_ENTRYPOINT``\ () function and then start other tasks
from your custom ``CONFIG_INIT_ENTRYPOINT``\ ().
#. NSH also supports a start-up script that executed when NSH first
runs. This mechanism has the advantage that the start-up script can

View File

@ -60,7 +60,7 @@ with NuttX. The list is the following:
``CONFIG_LIBC_EXECFUNCS=y`` ``CONFIG_SYMTAB_ORDEREDBYNAME=y``
``CONFIG_LIBC_STRERROR=y`` ``CONFIG_SYSTEM_NSH=y``
``CONFIG_MAX_TASKS=16`` ``CONFIG_SYSTEM_NSH_STACKSIZE=4096``
``CONFIG_NSH_BUILTIN_APPS=y`` ``CONFIG_USER_ENTRYPOINT="nsh_main"``
``CONFIG_NSH_BUILTIN_APPS=y`` ``CONFIG_INIT_ENTRYPOINT="nsh_main"``
``CONFIG_NSH_FILEIOSIZE=512``
==================================== =====================================

View File

@ -3109,7 +3109,7 @@ Or
Additional new features and extended functionality:
* RTOS: Application entry point is no longer user_start, but can be
configured using CONFIG_USER_ENTRYPOINT. NuttX now supports two work
configured using CONFIG_INIT_ENTRYPOINT. NuttX now supports two work
queues: A lower priority work queue (for extended processing) and a
higher priority work queue (for quick, high priority operations).
@ -23783,7 +23783,7 @@ Additional new features and extended functionality:
Jerpelea.
- Enable internal flash storage for SPresence boards. The SmartFS
flash is mounted under /mnt/spif folder. From Alin Jerpelea.
- For compatibility with SDK we need to change the USER_ENTRYPOINT
- For compatibility with SDK we need to change the INIT_ENTRYPOINT
in all configurations to spresense_main(). From Alin Jerpelea.
* STMicro STM32:

View File

@ -94,7 +94,7 @@ EXTERN uint8_t g_nx_initstate; /* See enum nx_initstate_e */
/* This entry point must be supplied by the application */
int CONFIG_USER_ENTRYPOINT(int argc, char *argv[]);
int CONFIG_INIT_ENTRYPOINT(int argc, char *argv[]);
/* Functions contained in nx_task.c *****************************************/

View File

@ -301,18 +301,18 @@ endif # SMP
choice
prompt "Initialization Task"
default INIT_ENTRYPOINT if !BUILD_KERNEL
default INIT_FILEPATH if !BINFMT_DISABLE
default INIT_ENTRY if !BUILD_KERNEL
default INIT_FILE if !BINFMT_DISABLE
default INIT_NONE if BINFMT_DISABLE
config INIT_NONE
bool "None"
config INIT_ENTRYPOINT
bool "Via application entry point"
config INIT_ENTRY
bool "Via application entry"
depends on !BUILD_KERNEL
config INIT_FILEPATH
config INIT_FILE
bool "Via executable file"
depends on !BINFMT_DISABLE
@ -325,39 +325,39 @@ config INIT_ARGS
The argument list for user applications. e.g.:
"\"arg1\",\"arg2\",\"arg3\""
if INIT_ENTRYPOINT
config USER_ENTRYPOINT
string "Application entry point"
default "main"
---help---
The name of the entry point for user applications. For the example
applications this is of the form 'app_main' where 'app' is the application
name. If not defined, USER_ENTRYPOINT defaults to "main".
config USERMAIN_STACKSIZE
config INIT_STACKSIZE
int "Main thread stack size"
default DEFAULT_TASK_STACKSIZE
---help---
The size of the stack to allocate for the user initialization thread
that is started as soon as the OS completes its initialization.
config USERMAIN_PRIORITY
config INIT_PRIORITY
int "init thread priority"
default 100
---help---
The priority of the user initialization thread.
endif # INIT_ENTRYPOINT
if INIT_ENTRY
config INIT_ENTRYPOINT
string "Application entry point"
default "main"
---help---
The name of the entry point for user applications. For the example
applications this is of the form 'app_main' where 'app' is the application
name. If not defined, INIT_ENTRYPOINT defaults to "main".
if INIT_FILEPATH
endif # INIT_ENTRY
config USER_INITPATH
if INIT_FILE
config INIT_FILEPATH
string "Application initialization path"
default "/bin/init"
---help---
The name of the entry point for user applications. For the example
applications this is of the form 'app_main' where 'app' is the application
name. If not defined, USER_ENTRYPOINT defaults to "main".
name. If not defined, INIT_ENTRYPOINT defaults to "main".
config INIT_SYMTAB
string "Symbol table"
@ -423,7 +423,7 @@ config INIT_MOUNT_DATA
default ""
endif # INIT_MOUNT
endif # INIT_FILEPATH
endif # INIT_FILE
config RR_INTERVAL
int "Round robin timeslice (MSEC)"

View File

@ -107,7 +107,7 @@ void nx_idle_trampoline(void);
* And the main application entry point:
* symbols:
*
* - USER_ENTRYPOINT: This is the default user application entry point.
* - INIT_ENTRYPOINT: This is the default user application entry point.
*
* Input Parameters:
* None

View File

@ -58,34 +58,34 @@
# error No initialization mechanism selected (CONFIG_INIT_NONE)
#else
# if !defined(CONFIG_INIT_ENTRYPOINT) && !defined(CONFIG_INIT_FILEPATH)
# if !defined(CONFIG_INIT_ENTRY) && !defined(CONFIG_INIT_FILE)
/* For backward compatibility with older defconfig files when this was
* the way things were done.
*/
# define CONFIG_INIT_ENTRYPOINT 1
# define CONFIG_INIT_ENTRY 1
# endif
# if defined(CONFIG_INIT_ENTRYPOINT)
# if defined(CONFIG_INIT_ENTRY)
/* Initialize by starting a task at an entry point */
# ifndef CONFIG_USER_ENTRYPOINT
# ifndef CONFIG_INIT_ENTRYPOINT
/* Entry point name must have been provided */
# error CONFIG_USER_ENTRYPOINT must be defined
# error CONFIG_INIT_ENTRYPOINT must be defined
# endif
# elif defined(CONFIG_INIT_FILEPATH)
# elif defined(CONFIG_INIT_FILE)
/* Initialize by running an initialization program in the file system.
* Presumably the user has configured a board initialization function
* that will mount the file system containing the initialization
* program.
*/
# ifndef CONFIG_USER_INITPATH
# ifndef CONFIG_INIT_FILEPATH
/* Path to the initialization program must have been provided */
# error CONFIG_USER_INITPATH must be defined
# error CONFIG_INT_FILEPATH must be defined
# endif
# if !defined(CONFIG_INIT_SYMTAB) || !defined(CONFIG_INIT_NEXPORTS)
@ -108,8 +108,8 @@ extern const int CONFIG_INIT_NEXPORTS;
# undef CONFIG_LIBC_USRWORK
#endif
#if !defined(CONFIG_USERMAIN_PRIORITY)
# define CONFIG_USERMAIN_PRIORITY SCHED_PRIORITY_DEFAULT
#if !defined(CONFIG_INIT_PRIORITY)
# define CONFIG_INIT_PRIORITY SCHED_PRIORITY_DEFAULT
#endif
/****************************************************************************
@ -243,10 +243,10 @@ static inline void nx_start_application(void)
board_late_initialize();
#endif
#if defined(CONFIG_INIT_ENTRYPOINT)
#if defined(CONFIG_INIT_ENTRY)
/* Start the application initialization task. In a flat build, this is
* entrypoint is given by the definitions, CONFIG_USER_ENTRYPOINT. In
* entrypoint is given by the definitions, CONFIG_INIT_ENTRYPOINT. In
* the protected build, however, we must get the address of the
* entrypoint from the header at the beginning of the user-space blob.
*/
@ -255,17 +255,17 @@ static inline void nx_start_application(void)
#ifdef CONFIG_BUILD_PROTECTED
DEBUGASSERT(USERSPACE->us_entrypoint != NULL);
ret = nxtask_create("init", CONFIG_USERMAIN_PRIORITY,
CONFIG_USERMAIN_STACKSIZE,
ret = nxtask_create("init", CONFIG_INIT_PRIORITY,
CONFIG_INIT_STACKSIZE,
USERSPACE->us_entrypoint, argv);
#else
ret = nxtask_create("init", CONFIG_USERMAIN_PRIORITY,
CONFIG_USERMAIN_STACKSIZE,
(main_t)CONFIG_USER_ENTRYPOINT, argv);
ret = nxtask_create("init", CONFIG_INIT_PRIORITY,
CONFIG_INIT_STACKSIZE,
(main_t)CONFIG_INIT_ENTRYPOINT, argv);
#endif
DEBUGASSERT(ret > 0);
#elif defined(CONFIG_INIT_FILEPATH)
#elif defined(CONFIG_INIT_FILE)
#ifdef CONFIG_INIT_MOUNT
/* Mount the file system containing the init program. */
@ -281,9 +281,9 @@ static inline void nx_start_application(void)
* of the board_late_initialize() operation.
*/
sinfo("Starting init task: %s\n", CONFIG_USER_INITPATH);
sinfo("Starting init task: %s\n", CONFIG_INIT_FILEPATH);
ret = exec(CONFIG_USER_INITPATH, argv,
ret = exec(CONFIG_INIT_FILEPATH, argv,
CONFIG_INIT_SYMTAB, CONFIG_INIT_NEXPORTS);
DEBUGASSERT(ret >= 0);
#endif
@ -377,9 +377,9 @@ static inline void nx_create_initthread(void)
* And the main application entry point:
* symbols, either:
*
* - CONFIG_USER_ENTRYPOINT: This is the default user application entry
* - CONFIG_INIT_ENTRYPOINT: This is the default user application entry
* point, or
* - CONFIG_USER_INITPATH: The full path to the location in a mounted
* - CONFIG_INIT_FILEPATH: The full path to the location in a mounted
* file system where we can expect to find the
* initialization program. Presumably, this file system
* was mounted by board-specific logic when

View File

@ -54,12 +54,12 @@ static const char *dequote_list[] =
"CONFIG_INIT_ARGS", /* Argument list of entry point */
"CONFIG_INIT_SYMTAB", /* Global symbol table */
"CONFIG_INIT_NEXPORTS", /* Global symbol table size */
"CONFIG_INIT_ENTRYPOINT", /* Name of entry point function */
"CONFIG_MODLIB_SYMTAB_ARRAY", /* Symbol table array used by modlib functions */
"CONFIG_MODLIB_NSYMBOLS_VAR", /* Variable holding number of symbols in the table */
"CONFIG_PASS1_BUILDIR", /* Pass1 build directory */
"CONFIG_PASS1_TARGET", /* Pass1 build target */
"CONFIG_PASS1_OBJECT", /* Pass1 build object */
"CONFIG_USER_ENTRYPOINT", /* Name of entry point function */
/* NxWidgets/NxWM */