nshlib: Rename CONFIG_SYSTEM_NSH_SYMTAB to CONFIG_NSH_SYMTAB
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
b659f0fbdf
commit
0d2ef47192
@ -203,6 +203,54 @@ config NSH_FILE_APPS
|
||||
system. This options requires support for the posix_spawn()
|
||||
interface (LIBC_EXECFUNCS).
|
||||
|
||||
config NSH_SYMTAB
|
||||
bool "Register symbol table"
|
||||
default n
|
||||
depends on LIBC_EXECFUNCS && BOARDCTL && !EXECFUNCS_HAVE_SYMTAB
|
||||
select BOARDCTL_APP_SYMTAB
|
||||
---help---
|
||||
Enable logic to automatically register an application symbol table
|
||||
as part of NSH initialization. If enabled, then application logic
|
||||
must provide the following:
|
||||
|
||||
const struct symtab_s g_exports[];
|
||||
const int g_nexports;
|
||||
|
||||
Where g_exports is the name of the exported application symbol table
|
||||
and g_nexports holds the number of entries in the application symbol
|
||||
table.
|
||||
|
||||
This is done very early in the NSH initialization sequence.
|
||||
|
||||
Why might you want to do this? There is really only one reason: You
|
||||
would like to have the symbol tables in place early so that programs
|
||||
started by NSH, perhaps via an initialization script, will have all
|
||||
of the necessary symbols in place. Otherwise, you probably do *not*
|
||||
want this option!
|
||||
|
||||
if NSH_SYMTAB
|
||||
|
||||
config NSH_SYMTAB_ARRAYNAME
|
||||
string "Symbol table used by exec[l|v]"
|
||||
default "g_exports"
|
||||
---help---
|
||||
The exec[l|v] and posix_spawn() functions needs to have (1) a
|
||||
symbol table that provides the list of symbols exported by the base
|
||||
code, and (2) the number of symbols in that table. This selection
|
||||
provides the name of that symbol table.
|
||||
|
||||
config NSH_SYMTAB_COUNTNAME
|
||||
string "Variable holding the number of symbols"
|
||||
default "g_nexports"
|
||||
---help---
|
||||
The exec[l|v] and posix_spawn() functions needs to have (1) a
|
||||
symbol table that provides the list of symbols exported by the base
|
||||
code, and (2) the number of symbols in that table. This selection
|
||||
provides the name of 'int' variable that holds the number of symbol
|
||||
in the table.
|
||||
|
||||
endif # NSH_SYMTAB
|
||||
|
||||
menu "Disable Individual commands"
|
||||
|
||||
config NSH_DISABLE_ADDROUTE
|
||||
|
@ -41,7 +41,7 @@
|
||||
/* Symbol table is not needed if loadable binary modules are not supported */
|
||||
|
||||
#if !defined(CONFIG_LIBC_EXECFUNCS)
|
||||
# undef CONFIG_SYSTEM_NSH_SYMTAB
|
||||
# undef CONFIG_NSH_SYMTAB
|
||||
#endif
|
||||
|
||||
/* boardctl() support is also required for application-space symbol table
|
||||
@ -49,7 +49,7 @@
|
||||
*/
|
||||
|
||||
#if !defined(CONFIG_BOARDCTL) || !defined(CONFIG_BOARDCTL_APP_SYMTAB)
|
||||
# undef CONFIG_SYSTEM_NSH_SYMTAB
|
||||
# undef CONFIG_NSH_SYMTAB
|
||||
#endif
|
||||
|
||||
/* If a symbol table is provided by board-specific logic, then we do not
|
||||
@ -57,7 +57,7 @@
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_EXECFUNCS_HAVE_SYMTAB
|
||||
# undef CONFIG_SYSTEM_NSH_SYMTAB
|
||||
# undef CONFIG_NSH_SYMTAB
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -73,9 +73,9 @@ static const struct extmatch_vtable_s g_nsh_extmatch =
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SYSTEM_NSH_SYMTAB)
|
||||
extern const struct symtab_s CONFIG_SYSTEM_NSH_SYMTAB_ARRAYNAME[];
|
||||
extern const int CONFIG_SYSTEM_NSH_SYMTAB_COUNTNAME;
|
||||
#if defined(CONFIG_NSH_SYMTAB)
|
||||
extern const struct symtab_s CONFIG_NSH_SYMTAB_ARRAYNAME[];
|
||||
extern const int CONFIG_NSH_SYMTAB_COUNTNAME;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -100,7 +100,7 @@ extern const int CONFIG_SYSTEM_NSH_SYMTAB_COUNTNAME;
|
||||
|
||||
void nsh_initialize(void)
|
||||
{
|
||||
#if defined (CONFIG_SYSTEM_NSH_SYMTAB)
|
||||
#if defined (CONFIG_NSH_SYMTAB)
|
||||
struct boardioc_symtab_s symdesc;
|
||||
#endif
|
||||
#if defined(CONFIG_NSH_ROMFSETC) && !defined(CONFIG_NSH_DISABLESCRIPT)
|
||||
@ -129,11 +129,11 @@ void nsh_initialize(void)
|
||||
usbtrace_enable(TRACE_BITSET);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SYSTEM_NSH_SYMTAB)
|
||||
#if defined(CONFIG_NSH_SYMTAB)
|
||||
/* Make sure that we are using our symbol table */
|
||||
|
||||
symdesc.symtab = (FAR struct symtab_s *)CONFIG_SYSTEM_NSH_SYMTAB_ARRAYNAME; /* Discard 'const' */
|
||||
symdesc.nsymbols = CONFIG_SYSTEM_NSH_SYMTAB_COUNTNAME;
|
||||
symdesc.symtab = (FAR struct symtab_s *)CONFIG_NSH_SYMTAB_ARRAYNAME; /* Discard 'const' */
|
||||
symdesc.nsymbols = CONFIG_NSH_SYMTAB_COUNTNAME;
|
||||
|
||||
boardctl(BOARDIOC_APP_SYMTAB, (uintptr_t)&symdesc);
|
||||
#endif
|
||||
|
@ -21,54 +21,6 @@ config SYSTEM_NSH_STACKSIZE
|
||||
int "NuttX shell stack size"
|
||||
default DEFAULT_TASK_STACKSIZE
|
||||
|
||||
config SYSTEM_NSH_SYMTAB
|
||||
bool "Register symbol table"
|
||||
default n
|
||||
depends on LIBC_EXECFUNCS && BOARDCTL && !EXECFUNCS_HAVE_SYMTAB
|
||||
select BOARDCTL_APP_SYMTAB
|
||||
---help---
|
||||
Enable logic to automatically register an application symbol table
|
||||
as part of NSH initialization. If enabled, then application logic
|
||||
must provide the following:
|
||||
|
||||
const struct symtab_s g_exports[];
|
||||
const int g_nexports;
|
||||
|
||||
Where g_exports is the name of the exported application symbol table
|
||||
and g_nexports holds the number of entries in the application symbol
|
||||
table.
|
||||
|
||||
This is done very early in the NSH initialization sequence.
|
||||
|
||||
Why might you want to do this? There is really only one reason: You
|
||||
would like to have the symbol tables in place early so that programs
|
||||
started by NSH, perhaps via an initialization script, will have all
|
||||
of the necessary symbols in place. Otherwise, you probably do *not*
|
||||
want this option!
|
||||
|
||||
if SYSTEM_NSH_SYMTAB
|
||||
|
||||
config SYSTEM_NSH_SYMTAB_ARRAYNAME
|
||||
string "Symbol table used by exec[l|v]"
|
||||
default "g_exports"
|
||||
---help---
|
||||
The exec[l|v] and posix_spawn() functions needs to have (1) a
|
||||
symbol table that provides the list of symbols exported by the base
|
||||
code, and (2) the number of symbols in that table. This selection
|
||||
provides the name of that symbol table.
|
||||
|
||||
config SYSTEM_NSH_SYMTAB_COUNTNAME
|
||||
string "Variable holding the number of symbols"
|
||||
default "g_nexports"
|
||||
---help---
|
||||
The exec[l|v] and posix_spawn() functions needs to have (1) a
|
||||
symbol table that provides the list of symbols exported by the base
|
||||
code, and (2) the number of symbols in that table. This selection
|
||||
provides the name of 'int' variable that holds the number of symbol
|
||||
in the table.
|
||||
|
||||
endif # SYSTEM_NSH_SYMTAB
|
||||
|
||||
config SYSTEM_NSH_PROGNAME
|
||||
string "Program name"
|
||||
default "nsh"
|
||||
|
@ -66,8 +66,8 @@ echo ""
|
||||
if [ -z "$prefix" ]; then
|
||||
echo "#if defined(CONFIG_EXECFUNCS_HAVE_SYMTAB)"
|
||||
echo "const struct symtab_s CONFIG_EXECFUNCS_SYMTAB_ARRAY[] = "
|
||||
echo "#elif defined(CONFIG_SYSTEM_NSH_SYMTAB)"
|
||||
echo "const struct symtab_s CONFIG_SYSTEM_NSH_SYMTAB_ARRAYNAME[] = "
|
||||
echo "#elif defined(CONFIG_NSH_SYMTAB)"
|
||||
echo "const struct symtab_s CONFIG_NSH_SYMTAB_ARRAYNAME[] = "
|
||||
echo "#else"
|
||||
echo "const struct symtab_s dummy_symtab[] = "
|
||||
echo "#endif"
|
||||
@ -86,8 +86,8 @@ echo ""
|
||||
if [ -z "$prefix" ]; then
|
||||
echo "#if defined(CONFIG_EXECFUNCS_HAVE_SYMTAB)"
|
||||
echo "const int CONFIG_EXECFUNCS_NSYMBOLS_VAR = sizeof(CONFIG_EXECFUNCS_SYMTAB_ARRAY) / sizeof(struct symtab_s);"
|
||||
echo "#elif defined(CONFIG_SYSTEM_NSH_SYMTAB)"
|
||||
echo "const int CONFIG_SYSTEM_NSH_SYMTAB_COUNTNAME = sizeof(CONFIG_SYSTEM_NSH_SYMTAB_ARRAYNAME) / sizeof(struct symtab_s);"
|
||||
echo "#elif defined(CONFIG_NSH_SYMTAB)"
|
||||
echo "const int CONFIG_NSH_SYMTAB_COUNTNAME = sizeof(CONFIG_NSH_SYMTAB_ARRAYNAME) / sizeof(struct symtab_s);"
|
||||
echo "#else"
|
||||
echo "const int dummy_nsymtabs = sizeof(dummy_symtab) / sizeof(struct symtab_s);"
|
||||
echo "#endif"
|
||||
|
Loading…
x
Reference in New Issue
Block a user