Skip to content
This repository was archived by the owner on Dec 6, 2018. It is now read-only.

Commit ddbdb72

Browse files
committed
Merge pull request #115 from forGGe/release
0.2.0 release
2 parents 1699cd0 + 5679c8d commit ddbdb72

File tree

216 files changed

+6540
-68711
lines changed

Some content is hidden

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

216 files changed

+6540
-68711
lines changed

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
[submodule "kernel/freertos/freertos"]
22
path = kernel/freertos/freertos
33
url = https://github.com/cjlano/freertos.git
4+
[submodule "lib/cmsis/CMSIS"]
5+
path = lib/cmsis/CMSIS
6+
url = https://github.com/ARM-software/CMSIS.git
7+
[submodule "lib/stm32-spl/SPL"]
8+
path = lib/stm32-spl/SPL
9+
url = https://github.com/forGGe/spl-hub.git

.travis.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ branches:
55
only:
66
- develop
77
- master
8+
- release
89

910
install:
10-
- curl https://nixos.org/nix/install | sh
11+
- travis_retry curl https://nixos.org/nix/install -o nix_install.sh
12+
- sh nix_install.sh
1113
- . $HOME/.nix-profile/etc/profile.d/nix.sh
12-
- nix-shell --pure --run true
14+
- travis_retry nix-shell --pure --run true
1315

1416
script: nix-shell --pure --run ./scripts/ci_test.sh

CMakeLists.txt

+9-26
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,26 @@ include(CppcheckTargets)
1919
# TODO: add same configuration mechanism for choosing right kernel
2020
message(STATUS "Checking [CONFIG_PLATFORM]...")
2121
if(NOT DEFINED CONFIG_PLATFORM)
22-
message(STATUS "CONFIG_PLATFORM is not set, defaulting to 'host'...")
23-
set(PLATFORM_NAME host)
22+
message(STATUS "CONFIG_PLATFORM is not set, defaulting to 'host'...")
23+
set(PLATFORM_NAME host)
2424
else()
25-
message(STATUS "Platform will be used: ${CONFIG_PLATFORM}")
26-
set(PLATFORM_NAME ${CONFIG_PLATFORM}) # For convinience
25+
message(STATUS "Platform will be used: ${CONFIG_PLATFORM}")
26+
set(PLATFORM_NAME ${CONFIG_PLATFORM}) # For convinience
2727
endif()
2828

2929
# Set general flags for C\C++ compiler and linker
3030
set(CC_WARN_FLAGS "-Wall -Wextra -Wpedantic -Werror")
3131
set(CXX_WARN_FLAGS "${CC_WARN_FLAGS} -Weffc++")
3232

3333
set(CMAKE_C_FLAGS
34-
"${CMAKE_C_FLAGS} ${CC_WARN_FLAGS} ${CC_EXTRA_FLAGS}")
34+
"${CMAKE_C_FLAGS} ${CC_WARN_FLAGS} ${CC_EXTRA_FLAGS}")
3535
set(CMAKE_CXX_FLAGS
36-
"${CMAKE_CXX_FLAGS} ${CC_WARN_FLAGS} ${CXX_EXTRA_FLAGS}")
36+
"${CMAKE_CXX_FLAGS} ${CC_WARN_FLAGS} ${CXX_EXTRA_FLAGS}")
3737

3838
# Linker definitions is propagated by the platform.
3939
include(${CORE_DIR}/platform/common/linker.cmake)
4040

41-
# The top-level library target, essesnce of this project.
41+
# The top-level library target, essence of this project.
4242
add_library(${PROJECT_NAME} INTERFACE)
4343
target_link_libraries(${PROJECT_NAME} INTERFACE startup)
4444
target_link_libraries(${PROJECT_NAME} INTERFACE ${PLATFORM_NAME})
@@ -47,26 +47,9 @@ target_link_libraries(${PROJECT_NAME} INTERFACE ${PLATFORM_NAME})
4747
# that platform will be added in first place
4848
add_subdirectory(platform)
4949

50-
# Stripping is requested
51-
if (${CONFIG_EXEC_STRIP})
52-
# Create new name
53-
get_filename_component(EXEC_NAME ${EXEC_PATH} NAME)
54-
55-
# Make binary from the project object file
56-
add_custom_target(${EXEC_NAME}_bin ALL
57-
COMMAND ${CMAKE_OBJCOPY} --output-format=binary
58-
${EXEC_PATH} ${EXEC_PATH}.bin
59-
DEPENDS ${EXEC_PATH}
60-
COMMENT "Making binary from ${EXEC_PATH} ..."
61-
)
62-
63-
# Clean binary on 'make clean' call
64-
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${EXEC_PATH}.bin)
65-
endif()
66-
6750
# Required layer only when cross-compiling
68-
if (CMAKE_CROSSCOMPILING)
69-
add_subdirectory(sys)
51+
if(CMAKE_CROSSCOMPILING)
52+
add_subdirectory(sys)
7053
endif()
7154

7255
# Rest of modules

README.md

+17-12
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55

66
## Description
77

8-
The Core is highly configurable, straightforward C++ framework with minimum set of development dependencies. It aimed to reduce development efforts for embedded applications.
9-
The main idea of The Core is to make as much as possible in the compile time. This affects the way how the device drivers and peripherals are represented. In fact, each driver is the template class that is instantiated with all the dependencies in a distinct type by user of The Core in compile-time.
8+
The Core is highly configurable and straightforward C++ framework aimed to reduce development efforts for embedded applications.
9+
The main idea of The Core is to make as much as possible in the compile time.
10+
This affects the way how the device drivers and peripherals are represented.
11+
In fact, each driver is the template class that is instantiated with all the dependencies in a distinct type by user of The Core in the compile time.
1012

1113
You can check out more directly in the code of [the SPI driver](platform/stm32f4xx/export/platform/spi_bus.hpp) or [the USART bus](platform/stm32f4xx/export/platform/usart_bus.hpp).
1214

@@ -22,8 +24,9 @@ The project is at the initial stage. But something is already in there:
2224

2325
## Getting started
2426

25-
If you are interested in the simplest, ready-made demo project based on The Core,
26-
refer to [the blinky example project](https://github.com/forGGe/theCore-blinky).
27+
If you are interested in the simplest, ready-made demo project based on The Core, refer to [the blinky example project](https://github.com/forGGe/theCore-blinky).
28+
29+
You may also check [examples within theCore source tree](examples/).
2730

2831
In order to proceed with The Core itself, start cloning this repository:
2932
```
@@ -33,10 +36,7 @@ git clone https://github.com/forGGe/theCore.git
3336
When the code is received, you have to download and install all the dependencies.
3437
The process can take some time.
3538
To make it easier, I’d strongly recommend to download and install `nix`.
36-
The installation guide could be found
37-
[on the official website](https://nixos.org/nixos/manual/index.html#ch-installation) or
38-
[Domenkozar's blog](https://www.domenkozar.com/2014/01/02/getting-started-with-nix-package-manager/)
39-
.
39+
The installation guide can be found [on the official website](https://nixos.org/nixos/manual/index.html#ch-installation) or [Domenkozar's blog](https://www.domenkozar.com/2014/01/02/getting-started-with-nix-package-manager/).
4040

4141
After `nix` installation, run:
4242
```bash
@@ -69,13 +69,14 @@ Currently, the stm32f4xx platform is supported and available for further develop
6969

7070
## Documentation
7171

72-
The current documentation of The Core is completely stated in the code (as doxygen comments). To generate the HTML pages from Doxygen is quite enough to run:
72+
The current documentation of The Core is completely stated in the code (as doxygen comments).
73+
To generate the HTML pages from Doxygen is quite enough to run:
7374

7475
```bash
7576
make core_doc
7677
```
7778

78-
in the build directory (see [units](#unit-tests)).
79+
in the build directory (see [unit tests section](#unit-tests)).
7980

8081
## License
8182

@@ -84,6 +85,10 @@ The source code is distributed under LGPL v3.0 License.
8485

8586
## Contribution & Using
8687

87-
The project is on its very beginning, so any help is more than welcome and highly appreciated. If you'd like to take a part in the project growth and (or) have any questions – feel free to email me at [email protected], leave message at [gitter](https://gitter.im/forGGe/theCore) or simply check out [a list of issues](https://github.com/forGGe/theCore/issues). If you have any suggestions on The Core improvement or just like it how it is, don’t keep silence! I’ll be happy to read your reviews.
88+
The project is on its very beginning, so any help is more than welcome and highly appreciated.
89+
If you'd like to take a part in the project growth and (or) have any questions – feel free to email me at [email protected], leave message at [gitter](https://gitter.im/forGGe/theCore) or simply check out [a list of issues](https://github.com/forGGe/theCore/issues).
90+
If you have any suggestions on The Core improvement or just like it how it is, don’t keep silence! I’ll be happy to read your reviews.
8891

89-
You are welcome to use The Core in your own projects. If there is something that it’s not enough for this, please let me know via email or open some issues and we will do our best to handle this ASAP. Good luck!
92+
You are welcome to use The Core in your own projects.
93+
If there is something that it’s not enough for this, please let me know via email or open some issues and we will do our best to handle this ASAP.
94+
Good luck!

build_api.cmake

+73-55
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
if (__build_api_def)
1+
if(__build_api_def)
22
return()
3-
endif ()
3+
endif()
44
set(__build_api_def YES)
55

6-
76
# Might be reviewed
87
cmake_minimum_required(VERSION 3.2)
98

@@ -16,13 +15,13 @@ include(CMakeParseArguments)
1615
# Add modules dir to search path
1716
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules)
1817

19-
# Registers a project
20-
macro(register_project project_name path_to_exe_file)
21-
set(EXEC_PATH ${path_to_exe_file})
22-
23-
# Make sure the core is included
24-
add_subdirectory(${CORE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/core)
25-
endmacro()
18+
# Add test only if not cross-compiling
19+
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL ${CMAKE_SYSTEM_NAME})
20+
find_package(CppUTest)
21+
if(NOT ${CPPUTEST_FOUND})
22+
message(WARNING "CppUTest library not present. Tests are disabled.")
23+
endif()
24+
endif()
2625

2726
# Creates a host unit test with name unit_test_${test_name}
2827
# TODO: move this to separate module
@@ -33,50 +32,69 @@ endmacro()
3332
# [DEPENDS list_of_dependencies...]
3433
# [INC_DIRS list_of_include_directories...])
3534
function(add_unit_host_test)
36-
# All test can use most recent standart
37-
set(CMAKE_CXX_STANDARD 14)
38-
39-
# Add test only if not cross-compiling
40-
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL ${CMAKE_SYSTEM_NAME})
41-
42-
find_package(CppUTest REQUIRED)
43-
44-
cmake_parse_arguments(
45-
UNIT_TEST
46-
"OPTIONAL"
47-
"NAME"
48-
"SOURCES;DEPENDS;INC_DIRS"
49-
${ARGN}
50-
)
51-
52-
if(DEFINED UNIT_TEST_NAME AND DEFINED UNIT_TEST_SOURCES)
53-
set(UNIT_TEST_NAME unit_test_${UNIT_TEST_NAME})
54-
message("-----------------------------------------------")
55-
message(" Test added: ${UNIT_TEST_NAME}")
56-
message(" Test sources: ${UNIT_TEST_SOURCES}")
57-
58-
add_executable(${UNIT_TEST_NAME} ${UNIT_TEST_SOURCES})
59-
add_test(NAME ${UNIT_TEST_NAME} COMMAND ${UNIT_TEST_NAME})
60-
target_link_libraries(${UNIT_TEST_NAME} CppUTest)
61-
target_link_libraries(${UNIT_TEST_NAME} CppUTestExt)
62-
else()
63-
message(FATAL_ERROR "Test sources and name must be defined!")
64-
endif()
65-
66-
if(UNIT_TEST_DEPENDS)
67-
message(" Test dependencies: ${UNIT_TEST_DEPENDS}")
68-
target_link_libraries(${UNIT_TEST_NAME} ${UNIT_TEST_DEPENDS})
69-
endif()
70-
71-
if(UNIT_TEST_INC_DIRS)
72-
message(" Test includes: ${UNIT_TEST_INC_DIRS}")
73-
target_include_directories(
74-
${UNIT_TEST_NAME}
75-
PRIVATE
76-
${UNIT_TEST_INC_DIRS})
77-
endif()
35+
# All test can use most recent standart
36+
set(CMAKE_CXX_STANDARD 14)
37+
38+
# Protect from missing test utilities
39+
if(${CPPUTEST_FOUND})
40+
cmake_parse_arguments(
41+
UNIT_TEST
42+
""
43+
"NAME"
44+
"SOURCES;DEPENDS;INC_DIRS"
45+
${ARGN}
46+
)
47+
48+
if(DEFINED UNIT_TEST_NAME AND DEFINED UNIT_TEST_SOURCES)
49+
set(UNIT_TEST_NAME unit_test_${UNIT_TEST_NAME})
50+
message("-----------------------------------------------")
51+
message(" Test added: ${UNIT_TEST_NAME}")
52+
message(" Test sources: ${UNIT_TEST_SOURCES}")
53+
54+
add_executable(${UNIT_TEST_NAME} ${UNIT_TEST_SOURCES})
55+
add_test(NAME ${UNIT_TEST_NAME} COMMAND ${UNIT_TEST_NAME})
56+
target_link_libraries(${UNIT_TEST_NAME} CppUTest)
57+
target_link_libraries(${UNIT_TEST_NAME} CppUTestExt)
58+
else()
59+
message(FATAL_ERROR "Test sources and name must be defined!")
60+
endif()
61+
62+
if(UNIT_TEST_DEPENDS)
63+
message(" Test dependencies: ${UNIT_TEST_DEPENDS}")
64+
target_link_libraries(${UNIT_TEST_NAME} ${UNIT_TEST_DEPENDS})
65+
endif()
66+
67+
if(UNIT_TEST_INC_DIRS)
68+
message(" Test includes: ${UNIT_TEST_INC_DIRS}")
69+
target_include_directories(
70+
${UNIT_TEST_NAME}
71+
PRIVATE
72+
${UNIT_TEST_INC_DIRS})
73+
endif()
74+
75+
target_include_directories(${UNIT_TEST_NAME} PRIVATE ${CPPUTEST_INCLUDE_DIRS})
76+
message("-----------------------------------------------")
77+
endif()
78+
endfunction()
7879

79-
target_include_directories(${UNIT_TEST_NAME} PRIVATE ${CPPUTEST_INCLUDE_DIRS})
80-
message("-----------------------------------------------")
81-
endif()
80+
# Strips executable, effectively making binary file from it.
81+
# Use it, if binary is convinient form to deploy code into the board.
82+
#
83+
# Syntax:
84+
# strip_executable(exe_name)
85+
# exec_name - name of the target, that was previously added via
86+
# add_executable call
87+
function(strip_executable exec_name)
88+
# Make binary from the project object file
89+
add_custom_target(${exec_name}_bin ALL
90+
COMMAND ${CMAKE_OBJCOPY} --output-format=binary
91+
$<TARGET_FILE:${exec_name}>
92+
$<TARGET_FILE:${exec_name}>.bin
93+
DEPENDS ${exec_name}
94+
COMMENT "Making binary from ${exec_name} ..."
95+
)
96+
97+
# Clean binary on 'make clean' call
98+
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
99+
$<TARGET_FILE:${exec_name}>.bin)
82100
endfunction()

default.nix

+1-9
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,11 @@
22
{ pkgs ? import <nixpkgs> {}
33
}:
44
let
5-
gcc-arm-embedded = pkgs.callPackage_i686 ./nix/gcc-arm-embedded {
6-
dirName = "5.0";
7-
subdirName = "5-2015-q4-major";
8-
version = "5.2-2015q4-20151219";
9-
releaseType = "major";
10-
sha256 = "12mbwl9iwbw7h6gwwkvyvfmrsz7vgjz27jh2cz9z006ihzigi50y";
11-
};
12-
135
cpputest = pkgs.callPackage ./nix/cpputest {};
146

157
in with pkgs; {
168
coreEnv = stdenv.mkDerivation {
179
name = "thecore";
18-
buildInputs = [ cmake gcc5 cppcheck cpputest gcc-arm-embedded doxygen ];
10+
buildInputs = [ cmake gcc6 cppcheck cpputest gcc-arm-embedded-5_2 doxygen ];
1911
};
2012
}

dev/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
add_subdirectory(pcd8544)
22
add_subdirectory(sdspi)
33
add_subdirectory(bus)
4+
add_subdirectory(sensor)
5+
add_subdirectory(cs43l22)

dev/bus/CMakeLists.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
add_library(bus INTERFACE)
22
target_include_directories(bus INTERFACE export)
3-
target_link_libraries(bus INTERFACE utils)
4-
target_link_libraries(bus INTERFACE common_bus)
3+
target_link_libraries(bus INTERFACE dbg)
4+
target_link_libraries(bus INTERFACE platform_common)
5+
target_link_libraries(bus INTERFACE thread)
56

67
add_unit_host_test(NAME bus
78
SOURCES tests/bus_unit.cpp
8-
DEPENDS thread_common common_bus
9+
DEPENDS thread_common platform_common dbg
910
INC_DIRS export tests/mocks)

0 commit comments

Comments
 (0)