Add C++ HelloWorld example

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1706 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-04-19 13:05:39 +00:00
parent ad69d90fa6
commit f51ecc4741
5 changed files with 44 additions and 9 deletions

View File

@ -693,3 +693,4 @@
* eZ8Encore!: Add an I2C driver. * eZ8Encore!: Add an I2C driver.
* Add support for the Freescale i.MX1/L architecture and a configuration for * Add support for the Freescale i.MX1/L architecture and a configuration for
the Freescale MX1ADS development board. the Freescale MX1ADS development board.
* examples/helloxx: Added a simple C++ hello world example

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: April 12, 2009</p> <p>Last Updated: April 19, 2009</p>
</td> </td>
</tr> </tr>
</table> </table>
@ -1387,12 +1387,18 @@ nuttx-0.4.5 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* eZ8Encore!: Add an I2C driver. * eZ8Encore!: Add an I2C driver.
* Add support for the Freescale i.MX1/L architecture and a configuration for * Add support for the Freescale i.MX1/L architecture and a configuration for
the Freescale MX1ADS development board. the Freescale MX1ADS development board.
* examples/helloxx: Added a simple C++ hello world example
pascal-0.1.3 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt; pascal-0.1.3 2009-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
buildroot-0.1.4 2009-xx-xx &lt;spudmonkey@racsa.co.cr&gt; buildroot-0.1.4 2009-xx-xx &lt;spudmonkey@racsa.co.cr&gt;
* Add support for a blackfin toolchain using GCC 4.2.4 and binutils 2.19 * Add support for a blackfin toolchain using GCC 4.2.4 and binutils 2.19
* GCC 4.2.4 no longer attempts to build libstdc++. Now we can build g++!
* The ARM GCC-4.2.4 configuration was changed so that it now builds g++.
* Removed building of initial and final GCC. that is not necessary because
we do not build a libc. Now it builds almost twice as fast.
* Removed logic to build the target GCC. That is never used.
</pre></ul> </pre></ul>

View File

@ -37,6 +37,7 @@ include ${TOPDIR}/.config
CROSSDEV = arm-elf- CROSSDEV = arm-elf-
CC = $(CROSSDEV)gcc CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs AR = $(CROSSDEV)ar rcs
@ -47,6 +48,11 @@ OBJDUMP = $(CROSSDEV)objdump
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ifeq ("${CONFIG_DEBUG}","y") ifeq ("${CONFIG_DEBUG}","y")
ARCHOPTIMIZATION = -g ARCHOPTIMIZATION = -g
else else
@ -55,17 +61,19 @@ else
endif endif
ifeq ($(ARCHCCMAJOR),4) ifeq ($(ARCHCCMAJOR),4)
ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv4t -msoft-float -fno-builtin ARCHCPUFLAGS = -mtune=arm9tdmi -march=armv4t -msoft-float
else else
ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv4t -msoft-float -fno-builtin ARCHCPUFLAGS = -mapcs-32 -mtune=arm9tdmi -march=armv4t -msoft-float
endif endif
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHDEFINES = ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHPICFLAGS = -fpic
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__ AFLAGS = $(CFLAGS) -D__ASSEMBLY__
@ -88,6 +96,11 @@ define COMPILE
@$(CC) -c $(CFLAGS) $1 -o $2 @$(CC) -c $(CFLAGS) $1 -o $2
endef endef
define COMPILEXX
@echo "CXX: $1"
@$(CXX) -c $(CXXFLAGS) $1 -o $2
endef
define ASSEMBLE define ASSEMBLE
@echo "AS: $1" @echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2 @$(CC) -c $(AFLAGS) $1 -o $2

View File

@ -21,7 +21,7 @@ examples/dhcpd
cd examples/dhcpd cd examples/dhcpd
make -f Makefile.host make -f Makefile.host
Kernel configuratin settings: NuttX configuration settings:
CONFIG_EXAMPLE_DHCPD_NOMAC - (May be defined to use software assigned MAC) CONFIG_EXAMPLE_DHCPD_NOMAC - (May be defined to use software assigned MAC)
CONFIG_EXAMPLE_DHCPD_IPADDR - Target IP address CONFIG_EXAMPLE_DHCPD_IPADDR - Target IP address
@ -39,6 +39,21 @@ examples/hello
than examples/null with a single printf statement. Again useful only than examples/null with a single printf statement. Again useful only
for bringing up new NuttX architectures. for bringing up new NuttX architectures.
NuttX configuration settings:
CONFIG_EXAMPLE_HELLOXX_NOSTATICCONST - Set if system does not support
static constructors.
CONFIG_EXAMPLE_HELLOXX_NOSTACKCONST - Set if the systgem does not
support constructionof objects on the stack.
examples/helloxx
^^^^^^^^^^^^^^^^
This is C++ version of the "Hello, World!!" example. It is intended
only to verify that the C++ compiler is function, that basic C++
library suupport is available, and that class are instantiated
correctly.
examples/mount examples/mount
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^

View File

@ -314,13 +314,13 @@ EXTERN void weak_function fs_initialize(void);
EXTERN STATUS register_driver(const char *path, EXTERN STATUS register_driver(const char *path,
const struct file_operations *fops, const struct file_operations *fops,
mode_t mode, void *private); mode_t mode, void *priv);
/* fs_registerdriver.c ******************************************************/ /* fs_registerdriver.c ******************************************************/
EXTERN STATUS register_blockdriver(const char *path, EXTERN STATUS register_blockdriver(const char *path,
const struct block_operations *bops, const struct block_operations *bops,
mode_t mode, void *private); mode_t mode, void *priv);
/* fs_unregisterdriver.c ****************************************************/ /* fs_unregisterdriver.c ****************************************************/