diff options
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/configs/sim/cxxtest/defconfig | 3 | ||||
-rw-r--r-- | nuttx/include/cxx/cstdbool | 9 | ||||
-rw-r--r-- | nuttx/include/cxx/cstdio | 12 | ||||
-rw-r--r-- | nuttx/include/nuttx/compiler.h | 6 | ||||
-rw-r--r-- | nuttx/libxx/Kconfig | 27 | ||||
-rw-r--r-- | nuttx/libxx/Makefile | 13 | ||||
-rw-r--r-- | nuttx/libxx/README.txt | 5 | ||||
-rw-r--r-- | nuttx/libxx/libxx_cxa_atexit.cxx | 3 |
8 files changed, 73 insertions, 5 deletions
diff --git a/nuttx/configs/sim/cxxtest/defconfig b/nuttx/configs/sim/cxxtest/defconfig index d7f5efff5..20d4e5c85 100644 --- a/nuttx/configs/sim/cxxtest/defconfig +++ b/nuttx/configs/sim/cxxtest/defconfig @@ -279,6 +279,9 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 CONFIG_HAVE_CXX=y # CONFIG_HAVE_CXXINITIALIZE is not set # CONFIG_CXX_NEWLONG is not set +CONFIG_UCLIBCXX=y +CONFIG_UCLIBCXX_EXCEPTION=y +CONFIG_UCLIBCXX_IOSTREAM_BUFSIZE=32 # # Application Configuration diff --git a/nuttx/include/cxx/cstdbool b/nuttx/include/cxx/cstdbool index d2f0639d2..192fde490 100644 --- a/nuttx/include/cxx/cstdbool +++ b/nuttx/include/cxx/cstdbool @@ -46,4 +46,13 @@ // Namespace //*************************************************************************** +//*************************************************************************** +// Namespace +//*************************************************************************** + +namespace std +{ + using ::_Bool8; +} + #endif // __INCLUDE_CXX_CSTDBOOL diff --git a/nuttx/include/cxx/cstdio b/nuttx/include/cxx/cstdio index 900d429cb..6a9620e1a 100644 --- a/nuttx/include/cxx/cstdio +++ b/nuttx/include/cxx/cstdio @@ -52,6 +52,8 @@ namespace std using ::FILE; using ::fpos_t; using ::size_t; + + using ::clearerr; using ::fclose; using ::fflush; using ::feof; @@ -69,16 +71,24 @@ namespace std using ::ftell; using ::fwrite; using ::gets; + using ::ungetc; + using ::printf; using ::puts; using ::rename; using ::sprintf; + using ::asprintf; using ::snprintf; - using ::ungetc; + using ::sscanf; + using ::perror; + using ::vprintf; using ::vfprintf; using ::vsprintf; + using ::avsprintf; using ::vsnprintf; + using ::vsscanf; + using ::fdopen; using ::statfs; } diff --git a/nuttx/include/nuttx/compiler.h b/nuttx/include/nuttx/compiler.h index 510f7d411..f700e539d 100644 --- a/nuttx/include/nuttx/compiler.h +++ b/nuttx/include/nuttx/compiler.h @@ -197,6 +197,7 @@ /* GCC supports both types double and long long */ # define CONFIG_HAVE_LONG_LONG 1 +# define CONFIG_HAVE_FLOAT 1 # define CONFIG_HAVE_DOUBLE 1 # define CONFIG_HAVE_LONG_DOUBLE 1 @@ -301,6 +302,7 @@ /* SDCC does not support type long long or type double */ # undef CONFIG_HAVE_LONG_LONG +# define CONFIG_HAVE_FLOAT 1 # undef CONFIG_HAVE_DOUBLE # undef CONFIG_HAVE_LONG_DOUBLE @@ -406,6 +408,7 @@ */ # undef CONFIG_HAVE_LONG_LONG +# define CONFIG_HAVE_FLOAT 1 # undef CONFIG_HAVE_DOUBLE # undef CONFIG_HAVE_LONG_DOUBLE @@ -441,8 +444,9 @@ # undef CONFIG_LONG_IS_NOT_INT # undef CONFIG_PTR_IS_NOT_INT # undef CONFIG_HAVE_INLINE -# define inline +# define inline 1 # undef CONFIG_HAVE_LONG_LONG +# define CONFIG_HAVE_FLOAT 1 # undef CONFIG_HAVE_DOUBLE # undef CONFIG_HAVE_LONG_DOUBLE # undef CONFIG_CAN_PASS_STRUCTS diff --git a/nuttx/libxx/Kconfig b/nuttx/libxx/Kconfig index 4133a0ceb..5ce2a8f7d 100644 --- a/nuttx/libxx/Kconfig +++ b/nuttx/libxx/Kconfig @@ -10,6 +10,10 @@ config HAVE_CXX Toolchain supports C++ and CXX, CXXFLAGS, and COMPILEXX have been defined in the configurations Make.defs file. +if HAVE_CXX + +comment "Basic CXX Support" + config HAVE_CXXINITIALIZE bool "Have C++ initialization" default n @@ -25,3 +29,26 @@ config CXX_NEWLONG size_t may be type long or type int. This matters for some C++ library routines because the NuttX size_t might not have the same underlying type as your toolchain's size_t. + +comment "uClibc++ Standard C++ Library" + +config UCLIBCXX + bool "Build uClibc++ (must be installed)" + default n + ---help--- + If you have installed uClibc++ into the NuttX source try, then it can + be built by selecting this option. See misc/uClibc++/README.txt for + information on installing uClibc++. + +if UCLIBCXX + +config UCLIBCXX_EXCEPTION + bool "Enable Exception Suppport" + default y + +config UCLIBCXX_IOSTREAM_BUFSIZE + int "IO Stream Buffer Size" + default 32 + +endif +endif diff --git a/nuttx/libxx/Makefile b/nuttx/libxx/Makefile index bc8c5012e..e563b9647 100644 --- a/nuttx/libxx/Makefile +++ b/nuttx/libxx/Makefile @@ -49,12 +49,19 @@ CXXSRCS += libxx_newa.cxx DEPPATH = --dep-path . VPATH = . -# Include the uClibc++ Make.defs file (if it is present). If is present, +# Include the uClibc++ Make.defs file if selected. If it is included, # the uClibc++/Make.defs file will add its files to the source file list, # add its DEPPATH info, and will add the appropriate paths to the VPATH # variable - --include uClibc++/Make.defs +# +# Note that an error will occur if you select CONFIG_LIBXX_UCLIBCXX +# without installing the uClibc++ package. This is intentional to let +# you know about the configuration problem. Refer to misc/uClibc++/README.txt +# for more information + +ifeq ($(CONFIG_UCLIBCXX),y) +include uClibc++/Make.defs +endif # Object Files diff --git a/nuttx/libxx/README.txt b/nuttx/libxx/README.txt index 6cf066f08..7a1c51fa7 100644 --- a/nuttx/libxx/README.txt +++ b/nuttx/libxx/README.txt @@ -12,6 +12,10 @@ are recommended: - uClibc++ http://cxx.uclibc.org/ - uSTL http://ustl.sourceforge.net/ +There is a version of uClibc++ that is customized for NuttX that can +be found here: misc/uClibc++. See misc/uClibc++ for installation +instructions. + At present, only the following are supported here: - void *operator new(std::size_t nbytes); @@ -19,6 +23,7 @@ At present, only the following are supported here: - void operator delete[](void *ptr); - void __cxa_pure_virtual(void); - int __aeabi_atexit(void* object, void (*destroyer)(void*), void *dso_handle); + - int __cxa_atexit(__cxa_exitfunc_t func, FAR void *arg, FAR void *dso_handle); operator new ------------ diff --git a/nuttx/libxx/libxx_cxa_atexit.cxx b/nuttx/libxx/libxx_cxa_atexit.cxx index 7e6d00a37..cd31f94f6 100644 --- a/nuttx/libxx/libxx_cxa_atexit.cxx +++ b/nuttx/libxx/libxx_cxa_atexit.cxx @@ -130,6 +130,9 @@ extern "C" { // Register the function to be called when the task/thread exists. + alloc->func = func; + alloc->arg = arg; + return on_exit(__cxa_callback, alloc); } else |