Skip to content
This repository was archived by the owner on Jul 21, 2021. It is now read-only.

File tree

1,424 files changed

+1271128
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,424 files changed

+1271128
-0
lines changed

.clang-format

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
BasedOnStyle: LLVM
3+
AccessModifierOffset: -4
4+
AllowShortIfStatementsOnASingleLine: false
5+
BreakBeforeBraces: Allman
6+
ColumnLimit: 0
7+
IndentCaseLabels: false
8+
IndentWidth: 4
9+
TabWidth: 4
10+
UseTab: 'Never'
11+
SortIncludes: false

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.o
2+
*.a
3+
/debug
4+
build
5+
builddir-*
6+
.vscode

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
4+
## [0.1.0] - 2019-09-30
5+
### Added
6+
* Initial Kiso code drop
7+
* Add BSP for CommonGateway
8+
* Cellular added
9+
* Add build-possibilities with CMake/Makefiles
10+
11+
### Changed
12+
* Improved documentation
13+
14+
15+
16+

CMakeLists.txt

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
cmake_minimum_required(VERSION 3.6)
2+
3+
## Command line parameter for build variant
4+
option(ENABLE_TESTING "Configure a build tree for testing instead of normal application mode" OFF)
5+
option(ENABLE_FORMAT_CHECKS "Run format checks during configuration stage and generate target to fix formatting" ON)
6+
option(SKIP_FORMAT_REPORTS "Skip generation of format XML reports in build directory" ON)
7+
option(ENABLE_STATIC_CHECKS "Configure a build tree for static code analysis" OFF)
8+
option(ENABLE_COVERAGE "Build unit tests with coverage information to use with GCOV and LCOV" ON)
9+
option(ENABLE_ALL_FEATURES "Configure a build tree in which all optional Kiso features are 'forced-ON'. Useful for static code analysis and test coverage reports. " OFF)
10+
11+
## Include config file if it exists
12+
include(default_config.cmake OPTIONAL)
13+
14+
## If no external toolchain is specified and we are not building just the unit tests, use the default arm toolchain.
15+
## Should be included as early as possible, before any project specification.
16+
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE AND NOT ${ENABLE_TESTING})
17+
include(toolchain_arm_gcc.cmake)
18+
endif()
19+
20+
message("------------- KISO CONFIG -------------")
21+
message("Building Kiso tests: ${ENABLE_TESTING}")
22+
message(" ... with coverage: ${ENABLE_COVERAGE}")
23+
message("Selected Kiso board: ${KISO_BOARD_NAME}")
24+
message("Selected Kiso OS: ${KISO_OS_LIB}")
25+
message("Selected Kiso Example: ${KISO_EXAMPLE}")
26+
message("------------- KISO CONFIG -------------")
27+
28+
project (Kiso C)
29+
30+
## Set basic project compile options
31+
set(CMAKE_C_STANDARD 99)
32+
set(CMAKE_C_EXTENSIONS false)
33+
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
34+
add_compile_options(-Werror -Wall -Wextra -Wdouble-promotion
35+
-Wformat=2 -Winit-self -Wunused -Wunused-const-variable -Wnull-dereference
36+
-Wuninitialized -fstrict-overflow -Wstrict-overflow=4 -Wshadow -Wcast-qual)
37+
38+
set(KISO_CENTRAL_CONFIG_DIR ${CMAKE_CURRENT_LIST_DIR}/config)
39+
40+
## Run format checks during configure stage
41+
if(${ENABLE_FORMAT_CHECKS})
42+
include(cmake/CodeFormatting.cmake)
43+
list(APPEND FOLDERS
44+
core thirdparty examples boards config docs)
45+
list(APPEND FILETYPES
46+
*.c *.cc *.cpp *.cxx *.c++
47+
*.h *.hh *.hpp *.hxx *.h++)
48+
ADD_TO_FORMATTING_TARGET("${FOLDERS}" "${FILETYPES}" "${SKIP_FORMAT_REPORTS}")
49+
endif()
50+
51+
## Needs to be in project scope before board is loaded
52+
if(${ENABLE_TESTING})
53+
enable_language(CXX)
54+
set(CMAKE_CXX_STANDARD 11)
55+
set(CMAKE_BUILD_TYPE Debug)
56+
57+
# In the gtest lib there are problems with these warnings - disable them
58+
add_compile_options(-Wno-unused-const-variable -Wno-missing-field-initializers -Wno-pedantic -Wno-error=deprecated-declarations)
59+
60+
enable_testing()
61+
if(${ENABLE_COVERAGE})
62+
include(cmake/CodeCoverage.cmake)
63+
64+
APPEND_COVERAGE_COMPILER_FLAGS() # From CodeCoverage module
65+
# Do not include coverage information for system headers and thirdparty libs
66+
set(COVERAGE_LCOV_EXCLUDES "'/usr/include/*'" "'/usr/local/include/*'" "'${CMAKE_SOURCE_DIR}/thirdparty/*'" "*_unittest.cc" "*_th.hh")
67+
68+
add_custom_target(coverage)
69+
endif(${ENABLE_COVERAGE})
70+
endif(${ENABLE_TESTING})
71+
72+
## Check for valid board and include the configuration
73+
if(NOT DEFINED KISO_BOARD_NAME)
74+
message(SEND_ERROR "KISO_BOARD_NAME is a required parameter! Use cmake <...> -DKISO_BOARD_NAME=... to specify.")
75+
elseif(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${KISO_BOARD_NAME}) # Use full path - undefined behavior with relative path
76+
message(SEND_ERROR "board_config.cmake missing for board ${KISO_BOARD_NAME}")
77+
else()
78+
include(boards/${KISO_BOARD_NAME}/board_config.cmake)
79+
endif()
80+
81+
if(${ENABLE_STATIC_CHECKS})
82+
find_program(CLANG_TIDY clang-tidy
83+
NAMES clang-tidy-10 clang-tidy-9 clang-tidy-8 clang-tidy-7)
84+
message(STATUS "Looking for clang-tidy: ${CLANG_TIDY}")
85+
endif()
86+
87+
## Add main application code
88+
add_subdirectory(examples/${KISO_BOARD_NAME}/${KISO_EXAMPLE})
89+
90+
## Add board and core libs
91+
add_subdirectory(boards)
92+
add_subdirectory(core/essentials)
93+
add_subdirectory(core/utils)
94+
add_subdirectory(core/connectivity)
95+
96+
## Add thirdparty libs
97+
add_subdirectory(thirdparty)
98+
99+
## Add the documentation (not built by default target)
100+
add_subdirectory(docs)

DISCLAIMER.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Warranty, Limitation of Liability, Responsibilities
2+
3+
Kiso and its documentation is provided “as is” and BOSCH does not grant any warranty that Kiso is error-free or will operate without interruption. Bosch grants no warranty regarding the use of Kiso or the results there-from including but not limited to its correctness, accuracy or reliability. BOSCH does not warrant the merchantability or fitness of Kiso for any particular use. BOSCH therefore excludes to the extent permitted by applicable law all other warranties with respect to Kiso, either express or implied, including but not limited to any infringement of third party rights based on the use of Kiso by the customer.
4+
5+
The Liability of BOSCH is – irrespective of its legal grounds – limited as follows: BOSCH shall be liable without limitation in case of intent and gross negligence or under a guarantee granted by Bosch. Unless expressly set out before the liability of BOSCH is excluded. This includes but is not limited to any liability for any direct, indirect, incidental, consequential or other damage including but not limited to any loss of data.
6+
7+
The Customer shall be responsible for conducting the integration of Kiso taking account of the state of the art in technology and all applicable statutory regulations and provisions. Moreover, the Customer shall be responsible to sufficiently validate and test its Customer Applications containing Kiso and shall make sure that the Customer Applications do not poses any hazards.

Jenkinsfile

+184
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
pipeline
2+
{
3+
agent // Define the agent to use
4+
{
5+
docker
6+
{
7+
label 'RT-Z0KHU'
8+
image 'rb-dtr.de.bosch.com/software-campus/kiso-toolchain:v0.4.3'
9+
registryUrl 'https://rb-dtr.de.bosch.com'
10+
registryCredentialsId 'docker-registry'
11+
}
12+
}
13+
options
14+
{
15+
timeout(time: 60, unit: 'MINUTES') // Define a timeout of 60 minutes
16+
timestamps() // Use a timestamp notation
17+
disableConcurrentBuilds() // We don't want to have concurrent build issues here
18+
}
19+
triggers // Define how many times the job will be triggered
20+
{
21+
pollSCM('*/5 * * * *') // If new changes exist, the Pipeline will be re-triggered automatically. Check will be done every 6 minutes
22+
}
23+
24+
stages
25+
{
26+
stage('Build Software')
27+
{
28+
steps // Define the steps of a stage
29+
{
30+
script // Run build
31+
{
32+
echo "Build the application"
33+
sh 'cmake . -Bbuilddir-debug -G"Ninja"'
34+
sh 'cmake --build builddir-debug'
35+
}
36+
}
37+
}
38+
stage('Run DoD')
39+
{
40+
parallel
41+
{
42+
stage('Format Checks')
43+
{
44+
steps
45+
{
46+
script
47+
{
48+
echo "enforce formatting rules"
49+
sh 'cmake . -Bbuilddir-formatting -G"Ninja" -DENABLE_FORMAT_CHECKS=1 -DSKIP_FORMAT_REPORTS=0'
50+
script {
51+
def reports = findFiles(glob: 'builddir-formatting/**/*_format.xml')
52+
sh "python3 ci/clang-format-to-junit.py ${reports.join(' ')} -o builddir-formatting/clang-format.xml -p builddir-formatting -s _format.xml"
53+
}
54+
}
55+
}
56+
}
57+
stage('Static Analysis')
58+
{
59+
steps
60+
{
61+
script
62+
{
63+
echo "run static analysis"
64+
sh 'cmake . -Bbuilddir-static -G"Unix Makefiles" -DKISO_BOARD_NAME=CommonGateway -DENABLE_STATIC_CHECKS=1 -DENABLE_ALL_FEATURES=1 -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON'
65+
sh 'cmake --build builddir-static 2> builddir-static/clang-report.txt'
66+
sh 'cat builddir-static/clang-report.txt | python ci/thirdparty/clangTidyToJunit/clang-tidy-to-junit.py `pwd` > builddir-static/clang-report.xml'
67+
}
68+
}
69+
}
70+
stage('Unit Tests')
71+
{
72+
steps
73+
{
74+
script
75+
{
76+
echo "run unit-tests"
77+
sh 'cmake . -Bbuilddir-unittests -G"Ninja" -DENABLE_TESTING=1 -DENABLE_ALL_FEATURES=1'
78+
sh 'cmake --build builddir-unittests'
79+
sh 'cd builddir-unittests && ctest -T test -V --no-compress-output' // Produce test results xml
80+
sh 'cmake --build builddir-unittests --target coverage -- -j1' // Produce coverage output (single-threaded because of ninja)
81+
}
82+
}
83+
}
84+
stage('Integration Tests')
85+
{
86+
steps
87+
{
88+
script
89+
{
90+
echo "run integration-tests placeholder"
91+
}
92+
}
93+
}
94+
stage('Doxygen Documentation')
95+
{
96+
steps
97+
{
98+
script
99+
{
100+
echo "Generate Doxygen"
101+
sh 'cmake --build builddir-debug --target docs'
102+
}
103+
}
104+
}
105+
stage('Hugo Documentation')
106+
{
107+
steps
108+
{
109+
script
110+
{
111+
echo "Generate Hugo Website"
112+
sh 'hugo -s docs/website'
113+
}
114+
}
115+
}
116+
} // parallel
117+
} // stage('Run DoD')
118+
} // stages
119+
120+
post // Called at very end of the script to notify developer and github about the result of the build
121+
{
122+
always
123+
{
124+
archiveArtifacts (
125+
artifacts: 'builddir-unittests/Testing/**/*.xml',
126+
fingerprint: true
127+
)
128+
archiveArtifacts (
129+
artifacts: 'builddir-static/clang-report.txt',
130+
fingerprint: true
131+
)
132+
archiveArtifacts (
133+
artifacts: 'builddir-formatting/**/*_format.xml',
134+
fingerprint: true
135+
)
136+
junit (
137+
allowEmptyResults: true,
138+
testResults: 'builddir-static/clang-report.xml'
139+
)
140+
junit (
141+
allowEmptyResults: true,
142+
testResults: 'builddir-formatting/clang-format.xml'
143+
)
144+
}
145+
success
146+
{
147+
archiveArtifacts (
148+
artifacts: 'builddir-debug/docs/doxygen/**, builddir-unittests/*_cov/**',
149+
fingerprint: true
150+
)
151+
}
152+
unstable
153+
{
154+
notifyFailed()
155+
}
156+
failure
157+
{
158+
notifyFailed()
159+
}
160+
aborted
161+
{
162+
notifyAbort()
163+
}
164+
}
165+
} // pipeline
166+
167+
168+
def notifyFailed()
169+
{
170+
emailext (subject: "Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) is failing",
171+
body: "Please go to ${env.BUILD_URL}, check it out AND fix it...",
172+
recipientProviders: [[$class: 'CulpritsRecipientProvider'],
173+
[$class: 'DevelopersRecipientProvider'],
174+
[$class: 'RequesterRecipientProvider']])
175+
}
176+
177+
def notifyAbort()
178+
{
179+
emailext (subject: "Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) was aborted",
180+
body: "Please go to ${env.BUILD_URL}, check what happened.",
181+
recipientProviders: [[$class: 'CulpritsRecipientProvider'],
182+
[$class: 'DevelopersRecipientProvider'],
183+
[$class: 'RequesterRecipientProvider']])
184+
}

0 commit comments

Comments
 (0)