Browse Source

Add logic to NSH startup to call C++ static initializers on startup

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4439 7fd9a85b-ad96-42d3-883c-3090e2eb8679
sbg
patacongo 13 years ago
parent
commit
157e80bb9d
  1. 2
      apps/ChangeLog.txt
  2. 8
      apps/examples/nsh/nsh_main.c
  3. 2
      nuttx/include/nuttx/arch.h

2
apps/ChangeLog.txt

@ -198,3 +198,5 @@ @@ -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.

8
apps/examples/nsh/nsh_main.c

@ -45,6 +45,8 @@ @@ -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[]) @@ -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();

2
nuttx/include/nuttx/arch.h

@ -511,7 +511,7 @@ EXTERN void up_udelay(useconds_t microseconds); @@ -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
*
***************************************************************************/

Loading…
Cancel
Save