NSH will now run files from the file system; Add logic to unload and clean-up after running a task from a file system; Extensions to builtin apps from Mike Smith

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5529 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2013-01-17 18:32:13 +00:00
parent cdc16263ee
commit 140d3e4374
9 changed files with 494 additions and 8 deletions

View File

@@ -46,6 +46,12 @@
#include <errno.h>
#include <nuttx/arch.h>
#if defined(CONFIG_FS_BINFS) && (CONFIG_BUILTIN)
#include <nuttx/binfmt/builtin.h>
#endif
#if defined(CONFIG_LIBC_EXECFUNCS) && defined(CONFIG_EXECFUNCS_SYMTAB)
#include <nuttx/binfmt/symtab.h>
#endif
#include <apps/nsh.h>
@@ -75,6 +81,21 @@
* Public Data
****************************************************************************/
/* If posix_spawn() is enabled as required for CONFIG_NSH_FILE_APPS, then
* a symbol table is needed by the internals of posix_spawn(). The symbol
* table is needed to support ELF and NXFLAT binaries to dynamically link to
* the base code. However, if only the BINFS file system is supported, then
* no Makefile is needed.
*
* This is a kludge to plug the missing file system in the case where BINFS
* is used. REVISIT: This will, of course, be in the way if you want to
* support ELF or NXFLAT binaries!
*/
#if defined(CONFIG_LIBC_EXECFUNCS) && defined(CONFIG_EXECFUNCS_SYMTAB)
const struct symtab_s CONFIG_EXECFUNCS_SYMTAB[1];
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -98,6 +119,23 @@ int nsh_main(int argc, char *argv[])
up_cxxinitialize();
#endif
/* Make sure that we are using our symbol take */
#if defined(CONFIG_LIBC_EXECFUNCS) && defined(CONFIG_EXECFUNCS_SYMTAB)
exec_setsymtab(CONFIG_EXECFUNCS_SYMTAB, 0);
#endif
/* Register the BINFS file system */
#if defined(CONFIG_FS_BINFS) && (CONFIG_BUILTIN)
ret = builtin_initialize();
if (ret < 0)
{
fprintf(stderr, "ERROR: builtin_initialize failed: %d\n", ret);
exitval = 1;
}
#endif
/* Initialize the NSH library */
nsh_initialize();