Add libsupc++ to sim/cxxtest configuration

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5296 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-11-02 00:22:52 +00:00
parent e162e760f7
commit cf2148e3f5
5 changed files with 109 additions and 86 deletions

View File

@ -100,18 +100,18 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
libarch$(LIBEXT): $(OBJS)
@( for obj in $(OBJS) ; do \
$(Q) ( for obj in $(OBJS) ; do \
$(call ARCHIVE, $@, $${obj}); \
done ; )
board/libboard$(LIBEXT):
@$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
$(Q) $(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
nuttx: $(HEAD_OBJ) board/libboard$(LIBEXT)
@echo "LD: nuttx"
@$(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_OBJ) $(EXTRA_OBJS) \
$(Q) echo "LD: nuttx"
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) -o $(NUTTX)$(EXEEXT) $(HEAD_OBJ) $(EXTRA_OBJS) \
--start-group $(LDLIBS) -lboard $(EXTRA_LIBS) $(LIBGCC) --end-group
@$(NM) $(NUTTX)$(EXEEXT) | \
$(Q) $(NM) $(NUTTX)$(EXEEXT) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > $(TOPDIR)/System.map
@ -121,7 +121,7 @@ nuttx: $(HEAD_OBJ) board/libboard$(LIBEXT)
export_head: board/libboard$(LIBEXT) $(HEAD_OBJ)
ifneq ($(HEAD_OBJ),)
@if [ -d "$(EXPORT_DIR)/startup" ]; then \
$(Q) if [ -d "$(EXPORT_DIR)/startup" ]; then \
cp -f $(HEAD_OBJ) "$(EXPORT_DIR)/startup"; \
else \
echo "$(EXPORT_DIR)/startup does not exist"; \
@ -132,26 +132,26 @@ endif
# Dependencies
.depend: Makefile chip/Make.defs $(SRCS)
@if [ -e board/Makefile ]; then \
$(Q) if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \
fi
@$(MKDEP) --dep-path chip --dep-path common --dep-path $(ARCH_SUBDIR) \
$(Q) $(MKDEP) --dep-path chip --dep-path common --dep-path $(ARCH_SUBDIR) \
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
$(Q) touch $@
depend: .depend
clean:
@if [ -e board/Makefile ]; then \
$(Q) if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" clean ; \
fi
@rm -f libarch$(LIBEXT) *~ .*.swp
$(Q) rm -f libarch$(LIBEXT) *~ .*.swp
$(call CLEAN)
distclean: clean
@if [ -e board/Makefile ]; then \
$(Q) if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" distclean ; \
fi
@rm -f Make.dep .depend
$(Q) rm -f Make.dep .depend
-include Make.dep

View File

@ -100,12 +100,17 @@ ifeq ($(CONFIG_SIM_TOUCHSCREEN),y)
endif
endif
EXTRA_LIBS ?=
ifeq ($(CONFIG_FS_FAT),y)
STDLIBS += -lz
endif
STDLIBS += -lc
LIBGCC := "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name}"
GCC_LIBDIR := ${shell dirname $(LIBGCC)}
# Determine which objects are required in the link. The
# up_head object normally draws in all that is needed, but
# there are a fews that must be included because they
@ -129,7 +134,7 @@ LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
# Add the board-specific library and directory
LDPATHS += -L board
LDPATHS += -L board -L $(GCC_LIBDIR)
LDLIBS += -lboard
# Make targets begin here
@ -145,13 +150,13 @@ $(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
$(HOSTOBJS): %$(OBJEXT): %.c
@echo "CC: $<"
@$(CC) -c $(HOSTCFLAGS) $< -o $@
$(Q) echo "CC: $<"
$(Q) $(CC) -c $(HOSTCFLAGS) $< -o $@
# The architecture-specific library
libarch$(LIBEXT): $(NUTTXOBJS)
@( for obj in $(NUTTXOBJS) ; do \
$(Q) ( for obj in $(NUTTXOBJS) ; do \
$(call ARCHIVE, $@, $${obj}); \
done ; )
@ -160,35 +165,35 @@ libarch$(LIBEXT): $(NUTTXOBJS)
# that are not hardware-related.
board/libboard$(LIBEXT):
@$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
$(Q) $(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
# A partially linked object containing only NuttX code (no interface to host OS)
# Change the names of most symbols that conflict with libc symbols.
GNU:
@mkdir ./GNU
$(Q) mkdir ./GNU
GNU/Linux-names.dat: GNU nuttx-names.dat
@cp nuttx-names.dat $@
$(Q) cp nuttx-names.dat $@
Cygwin-names.dat: nuttx-names.dat
@cat $^ | sed -e "s/^/_/g" >$@
$(Q) cat $^ | sed -e "s/^/_/g" >$@
nuttx.rel : libarch$(LIBEXT) board/libboard$(LIBEXT) $(HOSTOS)-names.dat $(LINKOBJS)
@echo "LD: nuttx.rel"
@$(LD) -r $(LDLINKFLAGS) $(LDPATHS) -o $@ $(REQUIREDOBJS) --start-group $(LDLIBS) $(EXTRA_LIBS) --end-group
@$(OBJCOPY) --redefine-syms=$(HOSTOS)-names.dat $@
$(Q) echo "LD: nuttx.rel"
$(Q) $(LD) -r $(LDLINKFLAGS) $(LDPATHS) -o $@ $(REQUIREDOBJS) --start-group $(LDLIBS) $(EXTRA_LIBS) --end-group
$(Q) $(OBJCOPY) --redefine-syms=$(HOSTOS)-names.dat $@
# Generate the final NuttX binary by linking the host-specific objects with the NuttX
# specific objects (with munged names)
nuttx$(EXEEXT): cleanrel nuttx.rel $(HOSTOBJS)
@echo "LD: nuttx$(EXEEXT)"
@$(CC) $(CCLINKFLAGS) $(LDPATHS) -o $(TOPDIR)/$@ nuttx.rel $(HOSTOBJS) $(DRVLIB) $(STDLIBS)
@$(NM) $(TOPDIR)/$@ | \
$(Q) echo "LD: nuttx$(EXEEXT)"
$(Q) $(CC) $(CCLINKFLAGS) $(LDPATHS) -o $(TOPDIR)/$@ nuttx.rel $(HOSTOBJS) $(DRVLIB) $(STDLIBS)
$(Q) $(NM) $(TOPDIR)/$@ | \
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > $(TOPDIR)/System.map
@rm -f nuttx.rel
$(Q) rm -f nuttx.rel
# This is part of the top-level export target
@ -200,26 +205,26 @@ export_head: board/libboard$(LIBEXT) up_head.o $(HOSTOBJS)
# Dependencies
.depend: Makefile $(SRCS)
@$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
$(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@
depend: .depend
cleanrel:
@rm -f nuttx.rel GNU/Linux-names.dat Cygwin-names.dat
$(Q) rm -f nuttx.rel GNU/Linux-names.dat Cygwin-names.dat
clean: cleanrel
@if [ -e board/Makefile ]; then \
$(Q) if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" clean ; \
fi
@rm -f nuttx.rel libarch$(LIBEXT) *~ .*.swp
$(Q) rm -f nuttx.rel libarch$(LIBEXT) *~ .*.swp
$(call CLEAN)
distclean: clean
@if [ -e board/Makefile ]; then \
$(Q) if [ -e board/Makefile ]; then \
$(MAKE) -C board TOPDIR="$(TOPDIR)" distclean ; \
fi
@rm -f Make.dep .depend
@rm -rf GNU
$(Q) rm -f Make.dep .depend
$(Q) rm -rf GNU
-include Make.dep

View File

@ -36,75 +36,77 @@
include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = -O2
ARCHOPTIMIZATION = -O2
endif
ARCHCPUFLAGS = -fno-builtin
ARCHCPUFLAGSXX = -fno-builtin
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx -isystem $(TOPDIR)/include/uClibc++
ARCHSCRIPT =
ARCHCPUFLAGS = -fno-builtin
ARCHCPUFLAGSXX = -fno-builtin
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx -isystem $(TOPDIR)/include/uClibc++
ARCHSCRIPT =
ifeq ($(CONFIG_SIM_M32),y)
ARCHCPUFLAGS += -m32
ARCHCPUFLAGSXX += -m32
ARCHCPUFLAGS += -m32
ARCHCPUFLAGSXX += -m32
endif
CROSSDEV =
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
CROSSDEV =
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
OBJEXT = .o
LIBEXT = .a
OBJEXT = .o
LIBEXT = .a
ifeq ($(HOSTOS),Cygwin)
EXEEXT = .exe
EXEEXT = .exe
else
EXEEXT =
EXEEXT =
endif
LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD)
CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC)
LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDLINKFLAGS += -g
CCLINKFLAGS += -g
LDFLAGS += -g
LDLINKFLAGS += -g
CCLINKFLAGS += -g
LDFLAGS += -g
endif
ifeq ($(CONFIG_SIM_M32),y)
LDLINKFLAGS += -melf_i386
CCLINKFLAGS += -m32
LDFLAGS += -m32
LDLINKFLAGS += -melf_i386
CCLINKFLAGS += -m32
LDFLAGS += -m32
endif
MKDEP = $(TOPDIR)/tools/mkdeps.sh
EXTRA_LIBS = -lsupc++
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
HOSTLDFLAGS =
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
HOSTLDFLAGS =

View File

@ -276,12 +276,21 @@ CONFIG_ARCH_LOWPUTC=y
CONFIG_LIB_SENDFILE_BUFSIZE=512
# CONFIG_ARCH_ROMGETC is not set
# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
#
# Basic CXX Support
#
CONFIG_HAVE_CXX=y
# CONFIG_HAVE_CXXINITIALIZE is not set
# CONFIG_CXX_NEWLONG is not set
#
# uClibc++ Standard C++ Library
#
CONFIG_UCLIBCXX=y
CONFIG_UCLIBCXX_EXCEPTION=y
CONFIG_UCLIBCXX_IOSTREAM_BUFSIZE=32
CONFIG_UCLIBCXX_HAVE_LIBSUPCXX=y
#
# Application Configuration

View File

@ -3,6 +3,8 @@
# see misc/tools/kconfig-language.txt.
#
comment "Basic CXX Support"
config HAVE_CXX
bool "Have C++ compiler"
default n
@ -12,8 +14,6 @@ config HAVE_CXX
if HAVE_CXX
comment "Basic CXX Support"
config HAVE_CXXINITIALIZE
bool "Have C++ initialization"
default n
@ -50,5 +50,12 @@ config UCLIBCXX_IOSTREAM_BUFSIZE
int "IO Stream Buffer Size"
default 32
config UCLIBCXX_HAVE_LIBSUPCXX
bool "Have libsupc++ (required)"
default y
---help---
Select if your toolchain provides libsupc++. This option is required
at present because the built-in libsupc++ support is incomplete.
endif
endif