init: move USERMAIN_XX out of INIT_ENTRYPOINT
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
36389dab76
commit
10ccba6671
@ -14,11 +14,11 @@ increasing difficulty:
|
|||||||
#. You replace the sample code at ``apps/examples/nsh/nsh_main.c`` with
|
#. 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
|
whatever start-up logic that you want. NSH is a library at
|
||||||
``apps/nshlib``. ``apps.examples/nsh`` is just a tiny, example
|
``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
|
immediately and illustrates how to start NSH If you want something
|
||||||
else to run immediately then you can write your write your own custom
|
else to run immediately then you can write your write your own custom
|
||||||
``CONFIG_USER_ENTRYPOINT``\ () function and then start other tasks
|
``CONFIG_INIT_ENTRYPOINT``\ () function and then start other tasks
|
||||||
from your custom ``CONFIG_USER_ENTRYPOINT``\ ().
|
from your custom ``CONFIG_INIT_ENTRYPOINT``\ ().
|
||||||
|
|
||||||
#. NSH also supports a start-up script that executed when NSH first
|
#. NSH also supports a start-up script that executed when NSH first
|
||||||
runs. This mechanism has the advantage that the start-up script can
|
runs. This mechanism has the advantage that the start-up script can
|
||||||
|
@ -60,7 +60,7 @@ with NuttX. The list is the following:
|
|||||||
``CONFIG_LIBC_EXECFUNCS=y`` ``CONFIG_SYMTAB_ORDEREDBYNAME=y``
|
``CONFIG_LIBC_EXECFUNCS=y`` ``CONFIG_SYMTAB_ORDEREDBYNAME=y``
|
||||||
``CONFIG_LIBC_STRERROR=y`` ``CONFIG_SYSTEM_NSH=y``
|
``CONFIG_LIBC_STRERROR=y`` ``CONFIG_SYSTEM_NSH=y``
|
||||||
``CONFIG_MAX_TASKS=16`` ``CONFIG_SYSTEM_NSH_STACKSIZE=4096``
|
``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``
|
``CONFIG_NSH_FILEIOSIZE=512``
|
||||||
==================================== =====================================
|
==================================== =====================================
|
||||||
|
|
||||||
|
@ -3109,7 +3109,7 @@ Or
|
|||||||
Additional new features and extended functionality:
|
Additional new features and extended functionality:
|
||||||
|
|
||||||
* RTOS: Application entry point is no longer user_start, but can be
|
* 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
|
queues: A lower priority work queue (for extended processing) and a
|
||||||
higher priority work queue (for quick, high priority operations).
|
higher priority work queue (for quick, high priority operations).
|
||||||
|
|
||||||
@ -23783,7 +23783,7 @@ Additional new features and extended functionality:
|
|||||||
Jerpelea.
|
Jerpelea.
|
||||||
- Enable internal flash storage for SPresence boards. The SmartFS
|
- Enable internal flash storage for SPresence boards. The SmartFS
|
||||||
flash is mounted under /mnt/spif folder. From Alin Jerpelea.
|
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.
|
in all configurations to spresense_main(). From Alin Jerpelea.
|
||||||
|
|
||||||
* STMicro STM32:
|
* STMicro STM32:
|
||||||
|
@ -94,7 +94,7 @@ EXTERN uint8_t g_nx_initstate; /* See enum nx_initstate_e */
|
|||||||
|
|
||||||
/* This entry point must be supplied by the application */
|
/* 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 *****************************************/
|
/* Functions contained in nx_task.c *****************************************/
|
||||||
|
|
||||||
|
@ -301,18 +301,18 @@ endif # SMP
|
|||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Initialization Task"
|
prompt "Initialization Task"
|
||||||
default INIT_ENTRYPOINT if !BUILD_KERNEL
|
default INIT_ENTRY if !BUILD_KERNEL
|
||||||
default INIT_FILEPATH if !BINFMT_DISABLE
|
default INIT_FILE if !BINFMT_DISABLE
|
||||||
default INIT_NONE if BINFMT_DISABLE
|
default INIT_NONE if BINFMT_DISABLE
|
||||||
|
|
||||||
config INIT_NONE
|
config INIT_NONE
|
||||||
bool "None"
|
bool "None"
|
||||||
|
|
||||||
config INIT_ENTRYPOINT
|
config INIT_ENTRY
|
||||||
bool "Via application entry point"
|
bool "Via application entry"
|
||||||
depends on !BUILD_KERNEL
|
depends on !BUILD_KERNEL
|
||||||
|
|
||||||
config INIT_FILEPATH
|
config INIT_FILE
|
||||||
bool "Via executable file"
|
bool "Via executable file"
|
||||||
depends on !BINFMT_DISABLE
|
depends on !BINFMT_DISABLE
|
||||||
|
|
||||||
@ -325,39 +325,39 @@ config INIT_ARGS
|
|||||||
The argument list for user applications. e.g.:
|
The argument list for user applications. e.g.:
|
||||||
"\"arg1\",\"arg2\",\"arg3\""
|
"\"arg1\",\"arg2\",\"arg3\""
|
||||||
|
|
||||||
if INIT_ENTRYPOINT
|
config INIT_STACKSIZE
|
||||||
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
|
|
||||||
int "Main thread stack size"
|
int "Main thread stack size"
|
||||||
default DEFAULT_TASK_STACKSIZE
|
default DEFAULT_TASK_STACKSIZE
|
||||||
---help---
|
---help---
|
||||||
The size of the stack to allocate for the user initialization thread
|
The size of the stack to allocate for the user initialization thread
|
||||||
that is started as soon as the OS completes its initialization.
|
that is started as soon as the OS completes its initialization.
|
||||||
|
|
||||||
config USERMAIN_PRIORITY
|
config INIT_PRIORITY
|
||||||
int "init thread priority"
|
int "init thread priority"
|
||||||
default 100
|
default 100
|
||||||
---help---
|
---help---
|
||||||
The priority of the user initialization thread.
|
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"
|
string "Application initialization path"
|
||||||
default "/bin/init"
|
default "/bin/init"
|
||||||
---help---
|
---help---
|
||||||
The name of the entry point for user applications. For the example
|
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
|
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
|
config INIT_SYMTAB
|
||||||
string "Symbol table"
|
string "Symbol table"
|
||||||
@ -423,7 +423,7 @@ config INIT_MOUNT_DATA
|
|||||||
default ""
|
default ""
|
||||||
|
|
||||||
endif # INIT_MOUNT
|
endif # INIT_MOUNT
|
||||||
endif # INIT_FILEPATH
|
endif # INIT_FILE
|
||||||
|
|
||||||
config RR_INTERVAL
|
config RR_INTERVAL
|
||||||
int "Round robin timeslice (MSEC)"
|
int "Round robin timeslice (MSEC)"
|
||||||
|
@ -107,7 +107,7 @@ void nx_idle_trampoline(void);
|
|||||||
* And the main application entry point:
|
* And the main application entry point:
|
||||||
* symbols:
|
* symbols:
|
||||||
*
|
*
|
||||||
* - USER_ENTRYPOINT: This is the default user application entry point.
|
* - INIT_ENTRYPOINT: This is the default user application entry point.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
|
@ -58,34 +58,34 @@
|
|||||||
# error No initialization mechanism selected (CONFIG_INIT_NONE)
|
# error No initialization mechanism selected (CONFIG_INIT_NONE)
|
||||||
|
|
||||||
#else
|
#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
|
/* For backward compatibility with older defconfig files when this was
|
||||||
* the way things were done.
|
* the way things were done.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# define CONFIG_INIT_ENTRYPOINT 1
|
# define CONFIG_INIT_ENTRY 1
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(CONFIG_INIT_ENTRYPOINT)
|
# if defined(CONFIG_INIT_ENTRY)
|
||||||
/* Initialize by starting a task at an entry point */
|
/* Initialize by starting a task at an entry point */
|
||||||
|
|
||||||
# ifndef CONFIG_USER_ENTRYPOINT
|
# ifndef CONFIG_INIT_ENTRYPOINT
|
||||||
/* Entry point name must have been provided */
|
/* Entry point name must have been provided */
|
||||||
|
|
||||||
# error CONFIG_USER_ENTRYPOINT must be defined
|
# error CONFIG_INIT_ENTRYPOINT must be defined
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# elif defined(CONFIG_INIT_FILEPATH)
|
# elif defined(CONFIG_INIT_FILE)
|
||||||
/* Initialize by running an initialization program in the file system.
|
/* Initialize by running an initialization program in the file system.
|
||||||
* Presumably the user has configured a board initialization function
|
* Presumably the user has configured a board initialization function
|
||||||
* that will mount the file system containing the initialization
|
* that will mount the file system containing the initialization
|
||||||
* program.
|
* program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# ifndef CONFIG_USER_INITPATH
|
# ifndef CONFIG_INIT_FILEPATH
|
||||||
/* Path to the initialization program must have been provided */
|
/* Path to the initialization program must have been provided */
|
||||||
|
|
||||||
# error CONFIG_USER_INITPATH must be defined
|
# error CONFIG_INT_FILEPATH must be defined
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if !defined(CONFIG_INIT_SYMTAB) || !defined(CONFIG_INIT_NEXPORTS)
|
# if !defined(CONFIG_INIT_SYMTAB) || !defined(CONFIG_INIT_NEXPORTS)
|
||||||
@ -108,8 +108,8 @@ extern const int CONFIG_INIT_NEXPORTS;
|
|||||||
# undef CONFIG_LIBC_USRWORK
|
# undef CONFIG_LIBC_USRWORK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CONFIG_USERMAIN_PRIORITY)
|
#if !defined(CONFIG_INIT_PRIORITY)
|
||||||
# define CONFIG_USERMAIN_PRIORITY SCHED_PRIORITY_DEFAULT
|
# define CONFIG_INIT_PRIORITY SCHED_PRIORITY_DEFAULT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -243,10 +243,10 @@ static inline void nx_start_application(void)
|
|||||||
board_late_initialize();
|
board_late_initialize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_INIT_ENTRYPOINT)
|
#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
|
||||||
* 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
|
* the protected build, however, we must get the address of the
|
||||||
* entrypoint from the header at the beginning of the user-space blob.
|
* 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
|
#ifdef CONFIG_BUILD_PROTECTED
|
||||||
DEBUGASSERT(USERSPACE->us_entrypoint != NULL);
|
DEBUGASSERT(USERSPACE->us_entrypoint != NULL);
|
||||||
ret = nxtask_create("init", CONFIG_USERMAIN_PRIORITY,
|
ret = nxtask_create("init", CONFIG_INIT_PRIORITY,
|
||||||
CONFIG_USERMAIN_STACKSIZE,
|
CONFIG_INIT_STACKSIZE,
|
||||||
USERSPACE->us_entrypoint, argv);
|
USERSPACE->us_entrypoint, argv);
|
||||||
#else
|
#else
|
||||||
ret = nxtask_create("init", CONFIG_USERMAIN_PRIORITY,
|
ret = nxtask_create("init", CONFIG_INIT_PRIORITY,
|
||||||
CONFIG_USERMAIN_STACKSIZE,
|
CONFIG_INIT_STACKSIZE,
|
||||||
(main_t)CONFIG_USER_ENTRYPOINT, argv);
|
(main_t)CONFIG_INIT_ENTRYPOINT, argv);
|
||||||
#endif
|
#endif
|
||||||
DEBUGASSERT(ret > 0);
|
DEBUGASSERT(ret > 0);
|
||||||
|
|
||||||
#elif defined(CONFIG_INIT_FILEPATH)
|
#elif defined(CONFIG_INIT_FILE)
|
||||||
|
|
||||||
#ifdef CONFIG_INIT_MOUNT
|
#ifdef CONFIG_INIT_MOUNT
|
||||||
/* Mount the file system containing the init program. */
|
/* 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.
|
* 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);
|
CONFIG_INIT_SYMTAB, CONFIG_INIT_NEXPORTS);
|
||||||
DEBUGASSERT(ret >= 0);
|
DEBUGASSERT(ret >= 0);
|
||||||
#endif
|
#endif
|
||||||
@ -377,9 +377,9 @@ static inline void nx_create_initthread(void)
|
|||||||
* And the main application entry point:
|
* And the main application entry point:
|
||||||
* symbols, either:
|
* symbols, either:
|
||||||
*
|
*
|
||||||
* - CONFIG_USER_ENTRYPOINT: This is the default user application entry
|
* - CONFIG_INIT_ENTRYPOINT: This is the default user application entry
|
||||||
* point, or
|
* 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
|
* file system where we can expect to find the
|
||||||
* initialization program. Presumably, this file system
|
* initialization program. Presumably, this file system
|
||||||
* was mounted by board-specific logic when
|
* was mounted by board-specific logic when
|
||||||
|
@ -54,12 +54,12 @@ static const char *dequote_list[] =
|
|||||||
"CONFIG_INIT_ARGS", /* Argument list of entry point */
|
"CONFIG_INIT_ARGS", /* Argument list of entry point */
|
||||||
"CONFIG_INIT_SYMTAB", /* Global symbol table */
|
"CONFIG_INIT_SYMTAB", /* Global symbol table */
|
||||||
"CONFIG_INIT_NEXPORTS", /* Global symbol table size */
|
"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_SYMTAB_ARRAY", /* Symbol table array used by modlib functions */
|
||||||
"CONFIG_MODLIB_NSYMBOLS_VAR", /* Variable holding number of symbols in the table */
|
"CONFIG_MODLIB_NSYMBOLS_VAR", /* Variable holding number of symbols in the table */
|
||||||
"CONFIG_PASS1_BUILDIR", /* Pass1 build directory */
|
"CONFIG_PASS1_BUILDIR", /* Pass1 build directory */
|
||||||
"CONFIG_PASS1_TARGET", /* Pass1 build target */
|
"CONFIG_PASS1_TARGET", /* Pass1 build target */
|
||||||
"CONFIG_PASS1_OBJECT", /* Pass1 build object */
|
"CONFIG_PASS1_OBJECT", /* Pass1 build object */
|
||||||
"CONFIG_USER_ENTRYPOINT", /* Name of entry point function */
|
|
||||||
|
|
||||||
/* NxWidgets/NxWM */
|
/* NxWidgets/NxWM */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user