Skip to content

Commit 139eb9c

Browse files
committed
Merge branch 'devel'
2 parents 2031819 + 3bf938b commit 139eb9c

File tree

8 files changed

+102
-32
lines changed

8 files changed

+102
-32
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
path = submodules/googletest
99
url = https://github.com/google/googletest
1010
ignore = dirty
11+
[submodule "submodules/cxxtest"]
12+
path = submodules/cxxtest
13+
url = https://github.com/CxxTest/cxxtest

.travis.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Set up notification options
2+
notifications:
3+
email:
4+
recipients:
5+
6+
7+
# change is when the repo status goes from pass to fail or vice versa
8+
on_success: change
9+
on_failure: always
10+
11+
# specify language
12+
language: cpp
13+
14+
# non-root build
15+
sudo: true
16+
17+
# specify language options
18+
19+
os:
20+
- linux
21+
22+
# configure which branches to run
23+
branches:
24+
# whitelist
25+
only:
26+
- master
27+
- devel
28+
29+
compiler:
30+
- clang++
31+
32+
script:
33+
- make check
34+
35+
before_install:
36+
- sudo apt-get -qq update
37+
- sudo apt-get install -y gcc-avr binutils-avr avr-libc arduino

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# arduino-skeleton
2+
[![Build Status](https://travis-ci.org/dannyp11/arduino-skeleton.svg?branch=master)](https://travis-ci.org/dannyp11/arduino-skeleton)
3+
24
This is the first embarkment of my learning experience & side projects. Let's see how far I could go :)
35
Skeleton framework for Arduino with/without RTOS, uses avr gcc/ g++
46
Currently works with Unix system, compatible with Arduino framework (setup/loop) using sudar's repo

ReleaseNote.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ RelNote -*- mode : org -*-
3838
- State "DONE" from "CANCELED" [2017-07-30 Sun 13:45]
3939
** DONE avoid recompiling gtest library every time running make check
4040
- State "DONE" from "CANCELED" [2017-07-30 Sun 13:46]
41+
** DONE integrate Travis CI in project
42+
- State "DONE" from "FEEDBACK" [2017-07-30 Sun 16:39]
43+
- State "FEEDBACK" from "INPROGRESS" [2017-07-30 Sun 16:39]
4144
** TODO motion sensor test code
4245
** TODO hand clap sound detector
4346
* WAIT v2.2.0 - more integrated module in i2c-console

common/makefiles/unittest.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
55
MKFILE_DIRNAME := $(notdir $(patsubst %/,%,$(dir $(MKFILE_PATH))))
66
TOP :=$(shell dirname $(MKFILE_PATH))/../../
77

8+
# cxxtest dir & pkg config
9+
CXXTEST_DIR ?=$(TOP)/submodules/cxxtest
10+
INCLUDES += $(CXXTEST_DIR)
11+
CXXTEST_GEN ?=$(CXXTEST_DIR)/bin/cxxtestgen
12+
813
# test objects definition
914
TEST_OBJECTS = $(patsubst %.cpp, %.ocxx, $(TEST_SOURCES))
1015
TEST_OBJECTS += $(patsubst %.c, %.ocxx, $(TEST_SOURCES))
@@ -22,7 +27,7 @@ IFLAGS = $(foreach d, $(INCLUDES), -I$d)
2227
# main rules to run
2328
##########################################################################################
2429
TEST_GEN:
25-
$(foreach f, $(TEST_HEADERS), cxxtestgen --error-printer -o $(f).cpp $(f) ; )
30+
$(foreach f, $(TEST_HEADERS), $(CXXTEST_GEN) --error-printer -o $(f).cpp $(f) ; )
2631
$(MAKE) test_compile
2732

2833
ifneq ($(filter $(BRIEF), $(TRUE)),) # check if compile message should be output, BRIEF means no

common/skeleton.mk

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ PROGRAMMER = -c arduino -P $(TTY) -b 115200
1616
# Directory path ####################################################################
1717
OS_DIR = $(TOP)/submodules/ChibiOS/
1818
ARDUINO_MAKEFILE_DIR = $(TOP)/submodules/Arduino-Makefile
19+
CXXTEST_DIR = $(TOP)/submodules/cxxtest
20+
GTEST_DIR = $(TOP)/submodules/googletest
1921
UTILS_DIR = $(TOP)/common/utils/
2022
MKFILES_DIR = $(TOP)/common/makefiles/
2123

@@ -100,6 +102,9 @@ TEST_CFLAGS += -DDEBUG=1 -g -O0
100102
endif
101103

102104
## help menu #########################################################################
105+
GCC_COLOR=\033[1;34m
106+
SRC_COLOR=\033[1;35m
107+
NO_COLOR=\033[0;0m
103108
define helpMenu
104109
--------------------------------------------------------------------------------------
105110
Configurable Variable names (* means required)
@@ -112,31 +117,35 @@ Device DEVICE uController chip $(DEVICE)
112117
Project CPP_PROJECT is C++ project? $(CPP_PROJECT)
113118
WITH_OS uses ChibiOS? $(WITH_OS)
114119
UTILS_SUPPORT utils such as i2c, debug, etc. $(UTILS_SUPPORT)
115-
UTILS_DIR path to utils source code $(UTILS_DIR)
120+
UTILS_DIR path to utils source code $(UTILS_DIR)
116121
FLOAT_SUPPORT support float printf/scanf $(FLOAT_SUPPORT)
117122
IDE_SUPPORT support ide lib (setup, loop)? $(IDE_SUPPORT)
118123
DEBUG add -DDEBUG=1 to cflags $(DEBUG)
119-
OPTIMIZE enable optimization? $(OPTIMIZE)
124+
OPTIMIZE enable optimization? $(OPTIMIZE)
120125
PROJECT_NAME name of project $(PROJECT_NAME)
121126

122-
Compiler CFLAGS add to cflag of avr gcc $(CFLAGS)
123-
CPPFLAGS add to c++ flags of avr g++ $(CPPFLAGS)
124-
*INCLUDES list of directories to include $(INCLUDES)
125-
*SOURCES all .c and .cpp files $(SOURCES)
127+
Compiler CFLAGS add to cflag of avr gcc $(GCC_COLOR)$(CFLAGS)$(NO_COLOR)
128+
CPPFLAGS add to c++ flags of avr g++ $(GCC_COLOR)$(CPPFLAGS)$(NO_COLOR)
129+
*INCLUDES list of directories to include $(SRC_COLOR)$(INCLUDES)$(NO_COLOR)
130+
131+
*SOURCES all .c and .cpp files $(SRC_COLOR)$(SOURCES)$(NO_COLOR)
126132

127133
SW Unittest UNITTEST_SUPPORT cxx test support $(UNITTEST_SUPPORT)
128134
GTEST_SUPPORT Google test support $(GTEST_SUPPORT)
129-
TEST_SOURCES files to be tested $(TEST_SOURCES)
135+
TEST_SOURCES files to be tested $(SRC_COLOR)$(TEST_SOURCES)$(NO_COLOR)
130136
(required if UNITTEST_SUPPORT is enabled)
131-
TEST_HEADERS list of .h files for cxxtest $(TEST_HEADERS)
137+
TEST_HEADERS list of .h files for cxxtest $(SRC_COLOR)$(TEST_HEADERS)$(NO_COLOR)
132138
usually inside proj/test/
133139
TEST_DEBUG add -DDEBUG flag to unittest? $(TEST_DEBUG)
134140
TEST_CC g++ of unit test $(TEST_CC)
135-
TEST_CFLAGS cflags of unit test $(TEST_CFLAGS)
141+
TEST_CFLAGS cflags of unit test $(GCC_COLOR)$(TEST_CFLAGS)$(NO_COLOR)
136142
--------------------------------------------------------------------------------------
137143
endef
138144
export helpMenu
145+
export GCC_COLOR
146+
export NO_COLOR
147+
export SRC_COLOR
139148
help:
140149
@$(TOP)/project_manager.sh -t 'Skeleton help menu:'
141-
@echo "$$helpMenu"
150+
@echo -e "$$helpMenu"
142151

project_manager.sh

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,18 @@ print_warning()
4040
# run all make check in directory recursively
4141
function checkFolder()
4242
{
43+
local retVal=0
4344
find "$1" -name Makefile | while read line; do
44-
local TEST_DIR=$(dirname $line)/test/
45-
if [ -d "$TEST_DIR" ] ; then
46-
print_title "Checking in $(dirname ${line})" ;
47-
make -C $(dirname $line) check BRIEF=1 -j4
48-
fi
49-
done
45+
local TEST_DIR=$(dirname $line)/test/
46+
if [ -d "$TEST_DIR" ] ; then
47+
print_title "Checking in $(dirname ${line})"
48+
make -C $(dirname $line) check BRIEF=1 -j4
49+
50+
((retVal = retVal + $?))
51+
fi
52+
done
53+
54+
return $retVal
5055
}
5156

5257
# run make clean in dir recursively
@@ -60,24 +65,29 @@ function cleanFolder()
6065
# run make all in dir recursively
6166
function makeFolder()
6267
{
68+
local retVal=0
69+
6370
find "$1" -name Makefile | while read line; do
64-
print_title "Compile in $(dirname ${line})..." ;
65-
66-
if (($FULL_REPORT == 0)) ; then
67-
make -C $(dirname $line) all -j4 > /dev/null
68-
else
69-
make -C $(dirname $line) all -j4
70-
fi
71+
print_title "Compile in $(dirname ${line})..." ;
72+
73+
if (($FULL_REPORT == 0)) ; then
74+
make -C $(dirname $line) all -j4 > /dev/null
75+
else
76+
make -C $(dirname $line) all -j4
77+
fi
7178

72-
local MK_RESULT=$?
79+
local MK_RESULT=$?
80+
((retVal=retVal + MK_RESULT))
7381

74-
if (($MK_RESULT!=0)) ; then
75-
print_warning "Error code $MK_RESULT on compiling $(dirname $line)"
76-
if (($FORCE_CONTINUE == 0)) ; then
77-
exit $MK_RESULT
78-
fi
79-
fi
80-
done
82+
if (($MK_RESULT!=0)) ; then
83+
print_warning "Error code $MK_RESULT on compiling $(dirname $line)"
84+
if (($FORCE_CONTINUE == 0)) ; then
85+
exit $MK_RESULT
86+
fi
87+
fi
88+
done
89+
90+
return $retVal
8191
}
8292

8393
function checkDependency()

submodules/cxxtest

Submodule cxxtest added at 191addd

0 commit comments

Comments
 (0)