git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9228 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
9ee0b0398a
commit
a5156a2f8f
|
@ -125,6 +125,7 @@ AR = $(TRGT)ar
|
||||||
OD = $(TRGT)objdump
|
OD = $(TRGT)objdump
|
||||||
SZ = $(TRGT)size
|
SZ = $(TRGT)size
|
||||||
BIN = $(CP) -O binary
|
BIN = $(CP) -O binary
|
||||||
|
COV = gcov
|
||||||
|
|
||||||
# Define C warning options here
|
# Define C warning options here
|
||||||
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
|
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
|
||||||
|
|
|
@ -164,6 +164,10 @@ clean:
|
||||||
@echo
|
@echo
|
||||||
@echo Done
|
@echo Done
|
||||||
|
|
||||||
|
.PHONY: gcov
|
||||||
|
gcov:
|
||||||
|
$(COV) -u -b -o $(BUILDDIR)/obj $(GCOVSRC)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Include the dependency files, should be the last of the makefile
|
# Include the dependency files, should be the last of the makefile
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,146 +1,170 @@
|
||||||
# This makefile expects the following variables to be externally
|
##############################################################################
|
||||||
# defined:
|
# Build global options
|
||||||
# XOPT - Compiler extra options
|
# NOTE: Can be overridden externally.
|
||||||
# XDEFS - Extra definitions
|
|
||||||
|
|
||||||
##############################################################################################
|
|
||||||
# Start of default section
|
|
||||||
#
|
#
|
||||||
|
|
||||||
TRGT = mingw32-
|
# Compiler options here.
|
||||||
CC = $(TRGT)gcc
|
ifeq ($(USE_OPT),)
|
||||||
AS = $(TRGT)gcc -x assembler-with-cpp
|
USE_OPT = $(XOPT)
|
||||||
AR = $(TRGT)ar
|
endif
|
||||||
COV = gcov
|
|
||||||
|
|
||||||
# List all default C defines here, like -D_DEBUG=1
|
# C specific options here (added to USE_OPT).
|
||||||
DDEFS = -DSIMULATOR
|
ifeq ($(USE_COPT),)
|
||||||
|
USE_COPT =
|
||||||
|
endif
|
||||||
|
|
||||||
# List all default ASM defines here, like -D_DEBUG=1
|
# C++ specific options here (added to USE_OPT).
|
||||||
DADEFS =
|
ifeq ($(USE_CPPOPT),)
|
||||||
|
USE_CPPOPT = -fno-rtti
|
||||||
|
endif
|
||||||
|
|
||||||
# List all default directories to look for include files here
|
# Enable this if you want the linker to remove unused code and data.
|
||||||
DINCDIR =
|
ifeq ($(USE_LINK_GC),)
|
||||||
|
USE_LINK_GC = yes
|
||||||
|
endif
|
||||||
|
|
||||||
# List the default directory to look for the libraries here
|
# Linker extra options here.
|
||||||
DLIBDIR =
|
ifeq ($(USE_LDOPT),)
|
||||||
|
USE_LDOPT =
|
||||||
|
endif
|
||||||
|
|
||||||
# List all default libraries here
|
# Enable this if you want link time optimizations (LTO)
|
||||||
DLIBS = -lws2_32
|
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
|
||||||
|
|
||||||
#
|
#
|
||||||
# End of default section
|
# Build global options
|
||||||
##############################################################################################
|
##############################################################################
|
||||||
|
|
||||||
##############################################################################################
|
##############################################################################
|
||||||
# Start of user section
|
# Architecture or project specific options
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Architecture or project specific options
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# Project, sources and paths
|
||||||
#
|
#
|
||||||
|
|
||||||
# Define project name here
|
# Define project name here
|
||||||
PROJECT = ch
|
PROJECT = ch
|
||||||
|
|
||||||
# Define linker script file here
|
# Imported source files and paths
|
||||||
LDSCRIPT=
|
CHIBIOS = ../../..
|
||||||
|
# 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
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# C sources here.
|
||||||
|
CSRC = $(STARTUPSRC) \
|
||||||
|
$(KERNSRC) \
|
||||||
|
$(PORTSRC) \
|
||||||
|
$(OSALSRC) \
|
||||||
|
$(HALSRC) \
|
||||||
|
$(PLATFORMSRC) \
|
||||||
|
$(BOARDSRC) \
|
||||||
|
$(TESTSRC) \
|
||||||
|
$(STREAMSSRC) \
|
||||||
|
$(SHELLSRC) \
|
||||||
|
main.c
|
||||||
|
|
||||||
|
# C++ sources here.
|
||||||
|
CPPSRC =
|
||||||
|
|
||||||
|
# List ASM source files here
|
||||||
|
ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
|
||||||
|
|
||||||
|
INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
|
||||||
|
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
|
||||||
|
$(STREAMSINC) $(SHELLINC)
|
||||||
|
|
||||||
|
# GCOV files.
|
||||||
|
GCOVSRC = $(KERNSRC)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Project, sources and paths
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# Compiler settings
|
||||||
|
#
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
# Define C warning options here
|
||||||
|
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
|
||||||
|
|
||||||
|
# Define C++ warning options here
|
||||||
|
CPPWARN = -Wall -Wextra -Wundef
|
||||||
|
|
||||||
|
#
|
||||||
|
# Compiler settings
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# Start of user section
|
||||||
|
#
|
||||||
|
|
||||||
# List all user C define here, like -D_DEBUG=1
|
# List all user C define here, like -D_DEBUG=1
|
||||||
UDEFS =
|
UDEFS = -DSIMULATOR $(XDEFS)
|
||||||
|
|
||||||
# Define ASM defines here
|
# Define ASM defines here
|
||||||
UADEFS =
|
UADEFS =
|
||||||
|
|
||||||
# Imported source files
|
|
||||||
CHIBIOS = ../../..
|
|
||||||
include $(CHIBIOS)/os/hal/boards/simulator/board.mk
|
|
||||||
include $(CHIBIOS)/os/hal/hal.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
|
|
||||||
include $(CHIBIOS)/os/rt/rt.mk
|
|
||||||
include $(CHIBIOS)/test/rt/test.mk
|
|
||||||
|
|
||||||
# List C source files here
|
|
||||||
SRC = $(PORTSRC) \
|
|
||||||
$(KERNSRC) \
|
|
||||||
$(TESTSRC) \
|
|
||||||
$(HALSRC) \
|
|
||||||
$(OSALSRC) \
|
|
||||||
$(PLATFORMSRC) \
|
|
||||||
$(BOARDSRC) \
|
|
||||||
main.c
|
|
||||||
|
|
||||||
# List ASM source files here
|
|
||||||
ASRC =
|
|
||||||
|
|
||||||
# List all user directories here
|
# List all user directories here
|
||||||
UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
|
UINCDIR =
|
||||||
$(HALINC) $(OSALINC) $(PLATFORMINC) $(BOARDINC) \
|
|
||||||
$(CHIBIOS)/os/various
|
|
||||||
|
|
||||||
# List the user directory to look for the libraries here
|
# List the user directory to look for the libraries here
|
||||||
ULIBDIR =
|
ULIBDIR =
|
||||||
|
|
||||||
# List all user libraries here
|
# List all user libraries here
|
||||||
ULIBS =
|
ULIBS = -lws2_32 -lgcov
|
||||||
|
|
||||||
# Define optimisation level here
|
|
||||||
OPT = $(XOPT)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# End of user defines
|
# End of user defines
|
||||||
##############################################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
RULESPATH = $(CHIBIOS)/os/common/startup/SIMIA32/compilers/GCC
|
||||||
INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
|
include $(RULESPATH)/rules.mk
|
||||||
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
|
|
||||||
DEFS = $(DDEFS) $(UDEFS) $(XDEFS)
|
|
||||||
ADEFS = $(DADEFS) $(UADEFS)
|
|
||||||
OBJS = $(ASRC:.s=.o) $(SRC:.c=.o)
|
|
||||||
LIBS = $(DLIBS) $(ULIBS)
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
# Generate dependency information
|
|
||||||
CPFLAGS += -MD -MP -MF .dep/$(@F).d
|
|
||||||
|
|
||||||
#
|
|
||||||
# makefile rules
|
|
||||||
#
|
|
||||||
|
|
||||||
all: $(OBJS) $(PROJECT).exe
|
|
||||||
|
|
||||||
%.o : %.c
|
|
||||||
$(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
|
|
||||||
|
|
||||||
%.o : %.s
|
|
||||||
$(AS) -c $(ASFLAGS) $< -o $@
|
|
||||||
|
|
||||||
%.exe: $(OBJS)
|
|
||||||
$(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
|
|
||||||
|
|
||||||
.PHONY: gcov
|
|
||||||
gcov:
|
|
||||||
$(COV) -u -f -b -o $(CHIBIOS)/os/rt/src $(KERNSRC)
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
misra:
|
misra:
|
||||||
@lint-nt -v -w3 $(DEFS) pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt $(INCDIR) $(KERNSRC)
|
@lint-nt -v -w3 $(DEFS) pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt $(IINCDIR) $(KERNSRC)
|
||||||
|
|
||||||
#
|
|
||||||
# Include the dependency files, should be the last of the makefile
|
|
||||||
#
|
|
||||||
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
|
||||||
|
|
||||||
# *** EOF ***
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export XOPT XDEFS
|
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=""
|
XDEFS=""
|
||||||
|
|
||||||
function clean() {
|
function clean() {
|
||||||
|
@ -12,7 +12,7 @@ function clean() {
|
||||||
|
|
||||||
function compile() {
|
function compile() {
|
||||||
echo -n " * Building..."
|
echo -n " * Building..."
|
||||||
if ! make > buildlog.txt
|
if ! make -j4 > buildlog.txt
|
||||||
then
|
then
|
||||||
echo "failed"
|
echo "failed"
|
||||||
clean
|
clean
|
||||||
|
@ -24,7 +24,7 @@ function compile() {
|
||||||
|
|
||||||
function execute_test() {
|
function execute_test() {
|
||||||
echo -n " * Testing..."
|
echo -n " * Testing..."
|
||||||
if ! ./ch > testlog.txt
|
if ! ./build/ch > testlog.txt
|
||||||
then
|
then
|
||||||
echo "failed"
|
echo "failed"
|
||||||
clean
|
clean
|
||||||
|
@ -38,7 +38,7 @@ function coverage() {
|
||||||
echo -n " * Coverage..."
|
echo -n " * Coverage..."
|
||||||
mkdir reports/${1}_gcov 2> /dev/null
|
mkdir reports/${1}_gcov 2> /dev/null
|
||||||
echo "Configuration $2" > gcovlog.txt
|
echo "Configuration $2" > gcovlog.txt
|
||||||
echo "----------------------------------------------------------------" >> reports/gcovlog.txt
|
echo "----------------------------------------------------------------" >> gcovlog.txt
|
||||||
if ! make gcov >> gcovlog.txt 2> /dev/null
|
if ! make gcov >> gcovlog.txt 2> /dev/null
|
||||||
then
|
then
|
||||||
echo "failed"
|
echo "failed"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include "test.h"
|
#include "ch_test.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -41,7 +41,7 @@ int main(int argc, char *argv[]) {
|
||||||
conInit();
|
conInit();
|
||||||
chSysInit();
|
chSysInit();
|
||||||
|
|
||||||
TestThread(&CD1);
|
test_execute((BaseSequentialStream *)&CD1);
|
||||||
if (test_global_fail)
|
if (test_global_fail)
|
||||||
exit(1);
|
exit(1);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue