From a5156a2f8fa55401d16405acfb51dc8b6999b484 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 3 Apr 2016 08:22:19 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9228 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/rt/testbuild/Makefile | 226 +++++++++++++++++++++++++-------------------- test/rt/testbuild/go.sh | 8 +- test/rt/testbuild/main.c | 4 +- 3 files changed, 131 insertions(+), 107 deletions(-) (limited to 'test/rt') diff --git a/test/rt/testbuild/Makefile b/test/rt/testbuild/Makefile index af684a19a..795971d7b 100644 --- a/test/rt/testbuild/Makefile +++ b/test/rt/testbuild/Makefile @@ -1,146 +1,170 @@ -# This makefile expects the following variables to be externally -# defined: -# XOPT - Compiler extra options -# XDEFS - Extra definitions - -############################################################################################## -# Start of default section +############################################################################## +# Build global options +# NOTE: Can be overridden externally. # -TRGT = mingw32- -CC = $(TRGT)gcc -AS = $(TRGT)gcc -x assembler-with-cpp -AR = $(TRGT)ar -COV = gcov - -# List all default C defines here, like -D_DEBUG=1 -DDEFS = -DSIMULATOR +# Compiler options here. +ifeq ($(USE_OPT),) + USE_OPT = $(XOPT) +endif + +# C specific options here (added to USE_OPT). +ifeq ($(USE_COPT),) + USE_COPT = +endif + +# C++ specific options here (added to USE_OPT). +ifeq ($(USE_CPPOPT),) + USE_CPPOPT = -fno-rtti +endif + +# Enable this if you want the linker to remove unused code and data. +ifeq ($(USE_LINK_GC),) + USE_LINK_GC = yes +endif + +# Linker extra options here. +ifeq ($(USE_LDOPT),) + USE_LDOPT = +endif + +# Enable this if you want link time optimizations (LTO) +ifeq ($(USE_LTO),) + USE_LTO = no +endif + +# Enable this if you want to see the full log while compiling. +ifeq ($(USE_VERBOSE_COMPILE),) + USE_VERBOSE_COMPILE = no +endif + +# If enabled, this option makes the build process faster by not compiling +# modules not used in the current configuration. +ifeq ($(USE_SMART_BUILD),) + USE_SMART_BUILD = yes +endif -# List all default ASM defines here, like -D_DEBUG=1 -DADEFS = - -# List all default directories to look for include files here -DINCDIR = - -# List the default directory to look for the libraries here -DLIBDIR = +# +# Build global options +############################################################################## -# List all default libraries here -DLIBS = -lws2_32 +############################################################################## +# Architecture or project specific options +# # -# End of default section -############################################################################################## +# Architecture or project specific options +############################################################################## -############################################################################################## -# Start of user section +############################################################################## +# Project, sources and paths # # Define project name here PROJECT = ch -# Define linker script file here -LDSCRIPT= - -# List all user C define here, like -D_DEBUG=1 -UDEFS = - -# Define ASM defines here -UADEFS = - -# Imported source files +# Imported source files and paths CHIBIOS = ../../.. -include $(CHIBIOS)/os/hal/boards/simulator/board.mk +# Startup files. +# HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk +include $(CHIBIOS)/os/hal/boards/simulator/board.mk include $(CHIBIOS)/os/hal/ports/simulator/win32/platform.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk -include $(CHIBIOS)/os/common/ports/SIMIA32/compilers/GCC/port.mk +# RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk +include $(CHIBIOS)/os/common/ports/SIMIA32/compilers/GCC/port.mk +# Other files (optional). include $(CHIBIOS)/test/rt/test.mk +include $(CHIBIOS)/os/hal/lib/streams/streams.mk +include $(CHIBIOS)/os/various/shell/shell.mk -# List C source files here -SRC = $(PORTSRC) \ +# C sources here. +CSRC = $(STARTUPSRC) \ $(KERNSRC) \ - $(TESTSRC) \ - $(HALSRC) \ + $(PORTSRC) \ $(OSALSRC) \ + $(HALSRC) \ $(PLATFORMSRC) \ $(BOARDSRC) \ + $(TESTSRC) \ + $(STREAMSSRC) \ + $(SHELLSRC) \ main.c -# List ASM source files here -ASRC = - -# List all user directories here -UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \ - $(HALINC) $(OSALINC) $(PLATFORMINC) $(BOARDINC) \ - $(CHIBIOS)/os/various +# C++ sources here. +CPPSRC = -# List the user directory to look for the libraries here -ULIBDIR = +# List ASM source files here +ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) -# List all user libraries here -ULIBS = +INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ + $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ + $(STREAMSINC) $(SHELLINC) -# Define optimisation level here -OPT = $(XOPT) +# GCOV files. +GCOVSRC = $(KERNSRC) # -# End of user defines -############################################################################################## +# Project, sources and paths +############################################################################## +############################################################################## +# Compiler settings +# -INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR)) -LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) -DEFS = $(DDEFS) $(UDEFS) $(XDEFS) -ADEFS = $(DADEFS) $(UADEFS) -OBJS = $(ASRC:.s=.o) $(SRC:.c=.o) -LIBS = $(DLIBS) $(ULIBS) +#TRGT = powerpc-eabi- +TRGT = mingw32- +CC = $(TRGT)gcc +CPPC = $(TRGT)g++ +# Enable loading with g++ only if you need C++ runtime support. +# NOTE: You can use C++ even without C++ support if you are careful. C++ +# runtime support makes code size explode. +LD = $(TRGT)gcc +#LD = $(TRGT)g++ +CP = $(TRGT)objcopy +AS = $(TRGT)gcc -x assembler-with-cpp +AR = $(TRGT)ar +OD = $(TRGT)objdump +SZ = $(TRGT)size +BIN = $(CP) -O binary +COV = gcov -LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch -lgcov $(LIBDIR) -ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) -CPFLAGS = $(OPT) -Wall -Wextra -Wundef -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS) +# Define C warning options here +CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -# Generate dependency information -CPFLAGS += -MD -MP -MF .dep/$(@F).d +# Define C++ warning options here +CPPWARN = -Wall -Wextra -Wundef # -# makefile rules -# - -all: $(OBJS) $(PROJECT).exe +# Compiler settings +############################################################################## -%.o : %.c - $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@ +############################################################################## +# Start of user section +# -%.o : %.s - $(AS) -c $(ASFLAGS) $< -o $@ +# List all user C define here, like -D_DEBUG=1 +UDEFS = -DSIMULATOR $(XDEFS) -%.exe: $(OBJS) - $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ +# Define ASM defines here +UADEFS = -.PHONY: gcov -gcov: - $(COV) -u -f -b -o $(CHIBIOS)/os/rt/src $(KERNSRC) +# List all user directories here +UINCDIR = -clean: - -rm -f $(OBJS) - -rm -f $(PROJECT).exe - -rm -f $(PROJECT).map - -rm -f $(SRC:.c=.c.bak) - -rm -f $(SRC:.c=.lst) - -rm -f $(SRC:.c=.gcno) - -rm -f $(SRC:.c=.gcda) - -rm -f $(ASRC:.s=.s.bak) - -rm -f $(ASRC:.s=.lst) - -rm -fR .dep +# List the user directory to look for the libraries here +ULIBDIR = -misra: - @lint-nt -v -w3 $(DEFS) pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt $(INCDIR) $(KERNSRC) +# List all user libraries here +ULIBS = -lws2_32 -lgcov # -# Include the dependency files, should be the last of the makefile -# --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) +# End of user defines +############################################################################## + +RULESPATH = $(CHIBIOS)/os/common/startup/SIMIA32/compilers/GCC +include $(RULESPATH)/rules.mk -# *** EOF *** +misra: + @lint-nt -v -w3 $(DEFS) pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt $(IINCDIR) $(KERNSRC) diff --git a/test/rt/testbuild/go.sh b/test/rt/testbuild/go.sh index ac73b7883..0dfd46a43 100644 --- a/test/rt/testbuild/go.sh +++ b/test/rt/testbuild/go.sh @@ -1,7 +1,7 @@ #!/bin/bash export XOPT XDEFS -XOPT="-ggdb -O0 -fomit-frame-pointer -DDELAY_BETWEEN_TESTS=0 -fprofile-arcs -ftest-coverage" +XOPT="-ggdb -O0 -fomit-frame-pointer -DTEST_DELAY_BETWEEN_TESTS=0 -fprofile-arcs -ftest-coverage" XDEFS="" function clean() { @@ -12,7 +12,7 @@ function clean() { function compile() { echo -n " * Building..." - if ! make > buildlog.txt + if ! make -j4 > buildlog.txt then echo "failed" clean @@ -24,7 +24,7 @@ function compile() { function execute_test() { echo -n " * Testing..." - if ! ./ch > testlog.txt + if ! ./build/ch > testlog.txt then echo "failed" clean @@ -38,7 +38,7 @@ function coverage() { echo -n " * Coverage..." mkdir reports/${1}_gcov 2> /dev/null echo "Configuration $2" > gcovlog.txt - echo "----------------------------------------------------------------" >> reports/gcovlog.txt + echo "----------------------------------------------------------------" >> gcovlog.txt if ! make gcov >> gcovlog.txt 2> /dev/null then echo "failed" diff --git a/test/rt/testbuild/main.c b/test/rt/testbuild/main.c index d7df4bbbb..7bb73cbeb 100644 --- a/test/rt/testbuild/main.c +++ b/test/rt/testbuild/main.c @@ -19,7 +19,7 @@ #include "ch.h" #include "hal.h" -#include "test.h" +#include "ch_test.h" #include "console.h" /* @@ -41,7 +41,7 @@ int main(int argc, char *argv[]) { conInit(); chSysInit(); - TestThread(&CD1); + test_execute((BaseSequentialStream *)&CD1); if (test_global_fail) exit(1); else -- cgit v1.2.3