aboutsummaryrefslogtreecommitdiff
path: root/apps/examples
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-01-23 23:56:24 -0800
committerpx4dev <px4@purgatory.org>2013-01-23 23:56:24 -0800
commit35febbe8441d0932881940eb2633080ab23f1e28 (patch)
tree07e1c0217a19f3476bf82c7cda5910a21ff0da90 /apps/examples
parentb60a744b773bb0752cb108b8d0bc2aad94c43b80 (diff)
parent63f8c0a954ef61ee416e78ea55899bc322aa313b (diff)
downloadpx4-firmware-35febbe8441d0932881940eb2633080ab23f1e28.tar.gz
px4-firmware-35febbe8441d0932881940eb2633080ab23f1e28.tar.bz2
px4-firmware-35febbe8441d0932881940eb2633080ab23f1e28.zip
Merge Nuttx r5554
Diffstat (limited to 'apps/examples')
-rw-r--r--apps/examples/nsh/nsh_main.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/examples/nsh/nsh_main.c b/apps/examples/nsh/nsh_main.c
index 97792cb2a..d9bfc2018 100644
--- a/apps/examples/nsh/nsh_main.c
+++ b/apps/examples/nsh/nsh_main.c
@@ -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();