diff --git a/ChangeLog b/ChangeLog index 77877350eb2..6a0cb7eb1ca 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10475,5 +10475,8 @@ remainder to round to the closed decisecond value, or use any non-zero remainder to the next larger whole decisecond value. Bug discovered by Librae (2015-05-29). + * configs/stm32f4discovery/src: Move up_cxxinitialize from + nuttx/configs/stm32f4discovery/src to apps/platform/stm32f4discovery + where it belongs (2015-05-29). * net/sockets, net/tcp, net/udp: UDP Networking: Add support for device event notification for UDP transfers (2015-05-29). diff --git a/arch/sim/src/nuttx-names.dat b/arch/sim/src/nuttx-names.dat index 634f4ea8cc8..de3062ce2f2 100644 --- a/arch/sim/src/nuttx-names.dat +++ b/arch/sim/src/nuttx-names.dat @@ -8,9 +8,11 @@ free NXfree fclose NXfclose fopen NXfopen fputc NXfputc +fcntl NXfcntl fread NXfread fwrite NXfwrite fsync NXfsync +getenv NXgetenv gettimeofday NXgettimeofday ioctl NXioctl isatty NXisatty @@ -23,6 +25,8 @@ mount NXmount open NXopen opendir NXopendir nanosleep NXnanosleep +poll NXpoll +printf NXprintf pthread_create NXpthread_create read NXread realloc NXrealloc @@ -32,6 +36,9 @@ rewinddir NXrewinddir rmdir NXrmdir seekdir NXseekdir select NXselect +sem_init NXsem_init +sem_post NXsem_post +sem_wait NXsem_wait send NXsend sighold NXsighold sigprocmask NXsigprocmask diff --git a/configs/stm32f4discovery/README.txt b/configs/stm32f4discovery/README.txt index 0d9a4df30f9..ea5d7a81ef1 100644 --- a/configs/stm32f4discovery/README.txt +++ b/configs/stm32f4discovery/README.txt @@ -1251,6 +1251,19 @@ Where is one of the following: on your system and that you have the full path to the installed genromfs executable in PATH variable (see apps/examples/README.txt) + 6. This configuration can be extended to use the hello++4 example and to build uClibc with the following additions to to the configuration file (from Leo aloe3132): + + CONFIG_C99_BOOL8=y + CONFIG_HAVE_CXXINITIALIZE=y + + CONFIG_UCLIBCXX=y + CONFIG_UCLIBCXX_EXCEPTION=y + CONFIG_UCLIBCXX_HAVE_LIBSUPCXX=y + CONFIG_UCLIBCXX_IOSTREAM_BUFSIZE=32 + + CONFIG_EXAMPLES_ELF_CXXINITIALIZE=y + CONFIG_EXAMPLES_ELF_UCLIBCXX=y + ipv6: ---- This is another version of the NuttShell configuration for the diff --git a/configs/stm32f4discovery/elf/defconfig b/configs/stm32f4discovery/elf/defconfig index f7e6898897b..7212e616f61 100644 --- a/configs/stm32f4discovery/elf/defconfig +++ b/configs/stm32f4discovery/elf/defconfig @@ -46,8 +46,9 @@ CONFIG_INTELHEX_BINARY=y # Debug Options # # CONFIG_DEBUG is not set -CONFIG_ARCH_HAVE_STACKCHECK=y CONFIG_ARCH_HAVE_HEAPCHECK=y +CONFIG_ARCH_HAVE_STACKCHECK=y +# CONFIG_STACK_COLORATION is not set # CONFIG_DEBUG_SYMBOLS is not set CONFIG_ARCH_HAVE_CUSTOMOPT=y # CONFIG_DEBUG_NOOPT is not set @@ -82,6 +83,7 @@ CONFIG_ARCH="arm" # CONFIG_ARCH_CHIP_KL is not set # CONFIG_ARCH_CHIP_LM is not set # CONFIG_ARCH_CHIP_TIVA is not set +# CONFIG_ARCH_CHIP_LPC11XX is not set # CONFIG_ARCH_CHIP_LPC17XX is not set # CONFIG_ARCH_CHIP_LPC214X is not set # CONFIG_ARCH_CHIP_LPC2378 is not set @@ -90,7 +92,9 @@ CONFIG_ARCH="arm" # CONFIG_ARCH_CHIP_NUC1XX is not set # CONFIG_ARCH_CHIP_SAMA5 is not set # CONFIG_ARCH_CHIP_SAMD is not set +# CONFIG_ARCH_CHIP_SAML is not set # CONFIG_ARCH_CHIP_SAM34 is not set +# CONFIG_ARCH_CHIP_SAMV7 is not set CONFIG_ARCH_CHIP_STM32=y # CONFIG_ARCH_CHIP_STR71X is not set # CONFIG_ARCH_ARM7TDMI is not set @@ -99,6 +103,7 @@ CONFIG_ARCH_CHIP_STM32=y # CONFIG_ARCH_CORTEXM0 is not set # CONFIG_ARCH_CORTEXM3 is not set CONFIG_ARCH_CORTEXM4=y +# CONFIG_ARCH_CORTEXM7 is not set # CONFIG_ARCH_CORTEXA5 is not set # CONFIG_ARCH_CORTEXA8 is not set CONFIG_ARCH_FAMILY="armv7-m" @@ -106,13 +111,19 @@ CONFIG_ARCH_CHIP="stm32" CONFIG_ARMV7M_USEBASEPRI=y CONFIG_ARCH_HAVE_CMNVECTOR=y # CONFIG_ARMV7M_CMNVECTOR is not set +# CONFIG_ARMV7M_LAZYFPU is not set CONFIG_ARCH_HAVE_FPU=y +# CONFIG_ARCH_HAVE_DPFPU is not set # CONFIG_ARCH_FPU is not set # CONFIG_ARMV7M_MPU is not set # # ARMV7M Configuration Options # +# CONFIG_ARMV7M_HAVE_ICACHE is not set +# CONFIG_ARMV7M_HAVE_DCACHE is not set +# CONFIG_ARMV7M_HAVE_ITCM is not set +# CONFIG_ARMV7M_HAVE_DTCM is not set # CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC is not set # CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set # CONFIG_ARMV7M_TOOLCHAIN_CODEREDW is not set @@ -121,7 +132,10 @@ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y # CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL is not set # CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW is not set # CONFIG_ARMV7M_TOOLCHAIN_RAISONANCE is not set +CONFIG_ARMV7M_HAVE_STACKCHECK=y +# CONFIG_ARMV7M_STACKCHECK is not set # CONFIG_ARMV7M_ITMSYSLOG is not set +# CONFIG_SERIAL_TERMIOS is not set # # STM32 Configuration Options @@ -145,6 +159,7 @@ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y # CONFIG_ARCH_CHIP_STM32L152V8 is not set # CONFIG_ARCH_CHIP_STM32L152VB is not set # CONFIG_ARCH_CHIP_STM32L162ZD is not set +# CONFIG_ARCH_CHIP_STM32L162VE is not set # CONFIG_ARCH_CHIP_STM32F100C8 is not set # CONFIG_ARCH_CHIP_STM32F100CB is not set # CONFIG_ARCH_CHIP_STM32F100R8 is not set @@ -157,6 +172,7 @@ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y # CONFIG_ARCH_CHIP_STM32F100VC is not set # CONFIG_ARCH_CHIP_STM32F100VD is not set # CONFIG_ARCH_CHIP_STM32F100VE is not set +# CONFIG_ARCH_CHIP_STM32F102CB is not set # CONFIG_ARCH_CHIP_STM32F103T8 is not set # CONFIG_ARCH_CHIP_STM32F103TB is not set # CONFIG_ARCH_CHIP_STM32F103C4 is not set @@ -177,6 +193,8 @@ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y # CONFIG_ARCH_CHIP_STM32F107VC is not set # CONFIG_ARCH_CHIP_STM32F207IG is not set # CONFIG_ARCH_CHIP_STM32F207ZE is not set +# CONFIG_ARCH_CHIP_STM32F302K6 is not set +# CONFIG_ARCH_CHIP_STM32F302K8 is not set # CONFIG_ARCH_CHIP_STM32F302CB is not set # CONFIG_ARCH_CHIP_STM32F302CC is not set # CONFIG_ARCH_CHIP_STM32F302RB is not set @@ -189,6 +207,24 @@ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y # CONFIG_ARCH_CHIP_STM32F303RC is not set # CONFIG_ARCH_CHIP_STM32F303VB is not set # CONFIG_ARCH_CHIP_STM32F303VC is not set +# CONFIG_ARCH_CHIP_STM32F372C8 is not set +# CONFIG_ARCH_CHIP_STM32F372R8 is not set +# CONFIG_ARCH_CHIP_STM32F372V8 is not set +# CONFIG_ARCH_CHIP_STM32F372CB is not set +# CONFIG_ARCH_CHIP_STM32F372RB is not set +# CONFIG_ARCH_CHIP_STM32F372VB is not set +# CONFIG_ARCH_CHIP_STM32F372CC is not set +# CONFIG_ARCH_CHIP_STM32F372RC is not set +# CONFIG_ARCH_CHIP_STM32F372VC is not set +# CONFIG_ARCH_CHIP_STM32F373C8 is not set +# CONFIG_ARCH_CHIP_STM32F373R8 is not set +# CONFIG_ARCH_CHIP_STM32F373V8 is not set +# CONFIG_ARCH_CHIP_STM32F373CB is not set +# CONFIG_ARCH_CHIP_STM32F373RB is not set +# CONFIG_ARCH_CHIP_STM32F373VB is not set +# CONFIG_ARCH_CHIP_STM32F373CC is not set +# CONFIG_ARCH_CHIP_STM32F373RC is not set +# CONFIG_ARCH_CHIP_STM32F373VC is not set # CONFIG_ARCH_CHIP_STM32F401RE is not set # CONFIG_ARCH_CHIP_STM32F411RE is not set # CONFIG_ARCH_CHIP_STM32F405RG is not set @@ -214,12 +250,14 @@ CONFIG_ARCH_CHIP_STM32F407VG=y # CONFIG_STM32_VALUELINE is not set # CONFIG_STM32_CONNECTIVITYLINE is not set # CONFIG_STM32_PERFORMANCELINE is not set +# CONFIG_STM32_USBACCESSLINE is not set # CONFIG_STM32_HIGHDENSITY is not set # CONFIG_STM32_MEDIUMDENSITY is not set # CONFIG_STM32_LOWDENSITY is not set # CONFIG_STM32_STM32F20XX is not set # CONFIG_STM32_STM32F207 is not set # CONFIG_STM32_STM32F30XX is not set +# CONFIG_STM32_STM32F37XX is not set CONFIG_STM32_STM32F40XX=y # CONFIG_STM32_STM32F401 is not set # CONFIG_STM32_STM32F411 is not set @@ -267,6 +305,7 @@ CONFIG_STM32_HAVE_SPI2=y CONFIG_STM32_HAVE_SPI3=y # CONFIG_STM32_HAVE_SPI4 is not set # CONFIG_STM32_HAVE_SPI5 is not set +# CONFIG_STM32_HAVE_SPI6 is not set # CONFIG_STM32_ADC1 is not set # CONFIG_STM32_ADC2 is not set # CONFIG_STM32_ADC3 is not set @@ -318,6 +357,7 @@ CONFIG_STM32_USART2=y # CONFIG_STM32_USART6 is not set # CONFIG_STM32_IWDG is not set # CONFIG_STM32_WWDG is not set +# CONFIG_STM32_NOEXT_VECTORS is not set # # Alternate Pin Mapping @@ -338,7 +378,10 @@ CONFIG_STM32_USART=y # # CONFIG_USART2_RS485 is not set # CONFIG_SERIAL_DISABLE_REORDERING is not set +# CONFIG_STM32_FLOWCONTROL_BROKEN is not set # CONFIG_STM32_USART_SINGLEWIRE is not set +# CONFIG_STM32_HAVE_RTC_COUNTER is not set +# CONFIG_STM32_HAVE_RTC_SUBSECONDS is not set # # USB FS Host Configuration @@ -432,6 +475,7 @@ CONFIG_ARCH_HAVE_IRQBUTTONS=y # Board-Specific Options # # CONFIG_STM32F4DISBB is not set +# CONFIG_LIB_BOARDCTL is not set # # RTOS Features @@ -467,7 +511,6 @@ CONFIG_INIT_ENTRYPOINT=y CONFIG_USER_ENTRYPOINT="elf_main" CONFIG_RR_INTERVAL=200 CONFIG_TASK_NAME_SIZE=0 -CONFIG_MAX_TASK_ARGS=4 CONFIG_MAX_TASKS=16 # CONFIG_SCHED_HAVE_PARENT is not set # CONFIG_SCHED_WAITPID is not set @@ -555,9 +598,13 @@ CONFIG_ARCH_HAVE_I2CRESET=y # CONFIG_I2C is not set # CONFIG_SPI is not set # CONFIG_I2S is not set + +# +# Timer Driver Support +# +# CONFIG_TIMER is not set # CONFIG_RTC is not set # CONFIG_WATCHDOG is not set -# CONFIG_TIMER is not set # CONFIG_ANALOG is not set # CONFIG_AUDIO_DEVICES is not set # CONFIG_VIDEO_DEVICES is not set @@ -566,6 +613,7 @@ CONFIG_ARCH_HAVE_I2CRESET=y # CONFIG_LCD is not set # CONFIG_MMCSD is not set # CONFIG_MTD is not set +# CONFIG_EEPROM is not set # CONFIG_PIPES is not set # CONFIG_PM is not set # CONFIG_POWER is not set @@ -602,8 +650,9 @@ CONFIG_ARCH_HAVE_USART2=y # CONFIG_USART2_ISUART=y CONFIG_MCU_SERIAL=y +# CONFIG_SERIAL_IFLOWCONTROL is not set +# CONFIG_SERIAL_OFLOWCONTROL is not set CONFIG_ARCH_HAVE_SERIAL_TERMIOS=y -# CONFIG_SERIAL_TERMIOS is not set CONFIG_USART2_SERIAL_CONSOLE=y # CONFIG_OTHER_SERIAL_CONSOLE is not set # CONFIG_NO_SERIAL_CONSOLE is not set @@ -619,8 +668,6 @@ CONFIG_USART2_PARITY=0 CONFIG_USART2_2STOP=0 # CONFIG_USART2_IFLOWCONTROL is not set # CONFIG_USART2_OFLOWCONTROL is not set -# CONFIG_SERIAL_IFLOWCONTROL is not set -# CONFIG_SERIAL_OFLOWCONTROL is not set # CONFIG_USBDEV is not set # CONFIG_USBHOST is not set # CONFIG_WIRELESS is not set @@ -633,6 +680,7 @@ CONFIG_USART2_2STOP=0 # System Logging # # CONFIG_RAMLOG is not set +# CONFIG_SYSLOG_CONSOLE is not set # # Networking Support @@ -722,6 +770,7 @@ CONFIG_LIB_HOMEDIR="/" # CONFIG_LIBM is not set # CONFIG_NOPRINTF_FIELDWIDTH is not set # CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_LIBC_IOCTL_VARIADIC is not set CONFIG_LIB_RAND_ORDER=1 # CONFIG_EOL_IS_CR is not set # CONFIG_EOL_IS_LF is not set @@ -734,6 +783,7 @@ CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=2048 # CONFIG_LIBC_PERROR_STDOUT is not set CONFIG_ARCH_LOWPUTC=y # CONFIG_LIBC_LOCALTIME is not set +# CONFIG_TIME_EXTENDED is not set CONFIG_LIB_SENDFILE_BUFSIZE=512 # CONFIG_ARCH_ROMGETC is not set # CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set @@ -803,6 +853,7 @@ CONFIG_EXAMPLES_ELF_DEVPATH="/dev/ram0" # CONFIG_EXAMPLES_OSTEST is not set # CONFIG_EXAMPLES_PIPE is not set # CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_PPPD is not set # CONFIG_EXAMPLES_POSIXSPAWN is not set # CONFIG_EXAMPLES_QENCODER is not set # CONFIG_EXAMPLES_RGMP is not set @@ -818,7 +869,6 @@ CONFIG_EXAMPLES_ELF_DEVPATH="/dev/ram0" # CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TOUCHSCREEN is not set -# CONFIG_EXAMPLES_UDP is not set # CONFIG_EXAMPLES_WEBSERVER is not set # CONFIG_EXAMPLES_USBSERIAL is not set # CONFIG_EXAMPLES_USBTERM is not set @@ -828,13 +878,15 @@ CONFIG_EXAMPLES_ELF_DEVPATH="/dev/ram0" # Graphics Support # # CONFIG_TIFF is not set +# CONFIG_GRAPHICS_TRAVELER is not set # # Interpreters # -# CONFIG_INTERPRETERS_FICL is not set # CONFIG_INTERPRETERS_BAS is not set +# CONFIG_INTERPRETERS_FICL is not set # CONFIG_INTERPRETERS_PCODE is not set +# CONFIG_INTERPRETERS_MICROPYTHON is not set # # Network Utilities @@ -844,15 +896,10 @@ CONFIG_EXAMPLES_ELF_DEVPATH="/dev/ram0" # Networking Utilities # # CONFIG_NETUTILS_CODECS is not set -# CONFIG_NETUTILS_DHCPD is not set # CONFIG_NETUTILS_FTPC is not set -# CONFIG_NETUTILS_FTPD is not set # CONFIG_NETUTILS_JSON is not set # CONFIG_NETUTILS_SMTP is not set -# CONFIG_NETUTILS_TFTPC is not set # CONFIG_NETUTILS_THTTPD is not set -# CONFIG_NETUTILS_NETLIB is not set -# CONFIG_NETUTILS_WEBCLIENT is not set # # FreeModBus @@ -876,114 +923,18 @@ CONFIG_EXAMPLES_ELF_DEVPATH="/dev/ram0" # # System Libraries and NSH Add-Ons # - -# -# Custom Free Memory Command -# # CONFIG_SYSTEM_FREE is not set - -# -# EMACS-like Command Line Editor -# # CONFIG_SYSTEM_CLE is not set - -# -# FLASH Program Installation -# +# CONFIG_SYSTEM_CUTERM is not set # CONFIG_SYSTEM_INSTALL is not set - -# -# FLASH Erase-all Command -# - -# -# Intel HEX to binary conversion -# # CONFIG_SYSTEM_HEX2BIN is not set - -# -# I2C tool -# - -# -# INI File Parser -# # CONFIG_SYSTEM_INIFILE is not set - -# -# NxPlayer media player library / command Line -# -# CONFIG_SYSTEM_NXPLAYER is not set - -# -# RAM test -# # CONFIG_SYSTEM_RAMTEST is not set - -# -# readline() -# # CONFIG_SYSTEM_READLINE is not set - -# -# P-Code Support -# - -# -# PHY Tool -# - -# -# Power Off -# # CONFIG_SYSTEM_POWEROFF is not set - -# -# RAMTRON -# # CONFIG_SYSTEM_RAMTRON is not set - -# -# SD Card -# # CONFIG_SYSTEM_SDCARD is not set - -# -# Sudoku -# # CONFIG_SYSTEM_SUDOKU is not set - -# -# Sysinfo -# # CONFIG_SYSTEM_SYSINFO is not set - -# -# VI Work-Alike Editor -# # CONFIG_SYSTEM_VI is not set - -# -# Stack Monitor -# - -# -# USB CDC/ACM Device Commands -# - -# -# USB Composite Device Commands -# - -# -# USB Mass Storage Device Commands -# - -# -# USB Monitor -# - -# -# Zmodem Commands -# # CONFIG_SYSTEM_ZMODEM is not set diff --git a/configs/stm32f4discovery/src/Makefile b/configs/stm32f4discovery/src/Makefile index f015866ff05..62276c7f248 100644 --- a/configs/stm32f4discovery/src/Makefile +++ b/configs/stm32f4discovery/src/Makefile @@ -1,7 +1,7 @@ ############################################################################ # configs/stm32f4discovery/src/Makefile # -# Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2013, 2015 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -42,10 +42,6 @@ AOBJS = $(ASRCS:.S=$(OBJEXT)) CSRCS = stm32_boot.c stm32_bringup.c stm32_spi.c -ifeq ($(CONFIG_HAVE_CXX),y) -CSRCS += stm32_cxxinitialize.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += stm32_autoleds.c else diff --git a/configs/stm32f4discovery/src/stm32_bringup.c b/configs/stm32f4discovery/src/stm32_bringup.c index cba0b704d3b..82fa73dd88f 100644 --- a/configs/stm32f4discovery/src/stm32_bringup.c +++ b/configs/stm32f4discovery/src/stm32_bringup.c @@ -48,6 +48,8 @@ # include #endif +#include + #include "stm32.h" #ifdef CONFIG_STM32_OTGFS diff --git a/configs/stm32f4discovery/src/stm32_cxxinitialize.c b/configs/stm32f4discovery/src/stm32_cxxinitialize.c deleted file mode 100644 index 68623633459..00000000000 --- a/configs/stm32f4discovery/src/stm32_cxxinitialize.c +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************************ - * configs/stm32f4discovery/src/stm32_cxxinitialize.c - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ************************************************************************************/ - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include - -#include - -#include -#include "chip.h" - -#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ -/* Debug ****************************************************************************/ -/* Non-standard debug that may be enabled just for testing the static constructors */ - -#ifndef CONFIG_DEBUG -# undef CONFIG_DEBUG_CXX -#endif - -#ifdef CONFIG_DEBUG_CXX -# define cxxdbg dbg -# define cxxlldbg lldbg -# ifdef CONFIG_DEBUG_VERBOSE -# define cxxvdbg vdbg -# define cxxllvdbg llvdbg -# else -# define cxxvdbg(x...) -# define cxxllvdbg(x...) -# endif -#else -# define cxxdbg(x...) -# define cxxlldbg(x...) -# define cxxvdbg(x...) -# define cxxllvdbg(x...) -#endif - -/************************************************************************************ - * Private Types - ************************************************************************************/ -/* This type defines one entry in initialization array */ - -typedef void (*initializer_t)(void); - -/************************************************************************************ - * External references - ************************************************************************************/ -/* _sinit and _einit are symbols exported by the linker script that mark the - * beginning and the end of the C++ initialization section. - */ - -extern initializer_t _sinit; -extern initializer_t _einit; - -/* _stext and _etext are symbols exported by the linker script that mark the - * beginning and the end of text. - */ - -extern uint32_t _stext; -extern uint32_t _etext; - -/************************************************************************************ - * Private Functions - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -/**************************************************************************** - * Name: up_cxxinitialize - * - * Description: - * If C++ and C++ static constructors are supported, then this function - * must be provided by board-specific logic in order to perform - * initialization of the static C++ class instances. - * - * 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 - * specific C++ code and platform-specific toolchain support - * - ***************************************************************************/ - -void up_cxxinitialize(void) -{ - initializer_t *initp; - - cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n", - &_sinit, &_einit, &_stext, &_etext); - - /* Visit each entry in the initialzation table */ - - for (initp = &_sinit; initp != &_einit; initp++) - { - initializer_t initializer = *initp; - cxxdbg("initp: %p initializer: %p\n", initp, initializer); - - /* Make sure that the address is non-NULL and lies in the text region - * defined by the linker script. Some toolchains may put NULL values - * or counts in the initialization table - */ - - if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext) - { - cxxdbg("Calling %p\n", initializer); - initializer(); - } - } -} - -#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */ -