summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-02-28 23:38:59 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-02-28 23:38:59 +0000
commit286b14b0c9d2dbad599e80cac9c269c9cd96b408 (patch)
tree8b7224b8a792bd3a3d8b10eb7cb45abbeb32e1b7
parent0819616be7c980481cd570ce39448d84408d7859 (diff)
downloadpx4-nuttx-286b14b0c9d2dbad599e80cac9c269c9cd96b408.tar.gz
px4-nuttx-286b14b0c9d2dbad599e80cac9c269c9cd96b408.tar.bz2
px4-nuttx-286b14b0c9d2dbad599e80cac9c269c9cd96b408.zip
Add logic to NSH startup to call C++ static initializers on startup
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4439 42af7a65-404d-4744-a932-0658087f49c3
-rwxr-xr-xapps/ChangeLog.txt2
-rw-r--r--apps/examples/nsh/nsh_main.c8
-rw-r--r--nuttx/include/nuttx/arch.h2
3 files changed, 11 insertions, 1 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt
index 8c4fdd4df..8317f2532 100755
--- a/apps/ChangeLog.txt
+++ b/apps/ChangeLog.txt
@@ -198,3 +198,5 @@
keyboard mappings of the Backspace key. Submitted by Mike Smith.
* apps/examples/cdcacm: An example that illustrates how the CDC/ACM driver
may to connected and disconnected through software control.
+ * apps/examples/nsh/nsh_main.c: If available, call up_cxxinitialize() to
+ initialize all statically defined C++ classes.
diff --git a/apps/examples/nsh/nsh_main.c b/apps/examples/nsh/nsh_main.c
index 5d302e397..1d1592b4d 100644
--- a/apps/examples/nsh/nsh_main.c
+++ b/apps/examples/nsh/nsh_main.c
@@ -45,6 +45,8 @@
#include <sched.h>
#include <errno.h>
+#include <nuttx/arch.h>
+
#include <apps/nsh.h>
/****************************************************************************
@@ -84,6 +86,12 @@ int user_start(int argc, char *argv[])
int exitval = 0;
int ret;
+ /* Call all C++ static constructors */
+
+#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
+ up_cxxinitialize();
+#endif
+
/* Initialize the NSH library */
nsh_initialize();
diff --git a/nuttx/include/nuttx/arch.h b/nuttx/include/nuttx/arch.h
index 18b5e9112..bf6be1ce0 100644
--- a/nuttx/include/nuttx/arch.h
+++ b/nuttx/include/nuttx/arch.h
@@ -511,7 +511,7 @@ EXTERN void up_udelay(useconds_t microseconds);
* This function should then be called in the application-specific
* user_start logic in order to perform the C++ initialization. NOTE
* that no component of the core NuttX RTOS logic is involved; This
- * function defintion only provides the 'contract' between application
+ * function definition only provides the 'contract' between application
* specific C++ code and platform-specific toolchain support
*
***************************************************************************/