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

Commit 28ac87f

Browse files
committed
Merge branch 'develop': release v0.3.0
2 parents df6e618 + 02a6830 commit 28ac87f

File tree

261 files changed

+64909
-6651
lines changed

Some content is hidden

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

261 files changed

+64909
-6651
lines changed

.gitmodules

+11
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,14 @@
77
[submodule "lib/stm32-spl/SPL"]
88
path = lib/stm32-spl/SPL
99
url = https://github.com/forGGe/spl-hub.git
10+
[submodule "lib/unity/Unity"]
11+
path = lib/unity/Unity
12+
url = https://github.com/forGGe/Unity.git
13+
# Base repo
14+
# url = https://github.com/ThrowTheSwitch/Unity.git
15+
[submodule "lib/ti-tivaware/ti-tivaware"]
16+
path = lib/ti-tivaware/ti-tivaware
17+
url = https://github.com/forGGe/ti-tivaware
18+
[submodule "lib/fs/fat/pff"]
19+
path = lib/fs/fat/pff
20+
url = https://github.com/forGGe/petite-fat

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ dist: trusty
44
branches:
55
only:
66
- develop
7+
- /^develop-.*$/
78
- master
89
- release
910

CMakeLists.txt

+29-22
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,65 @@
1-
# ASM is crucial
1+
# ASM is crucial
22
enable_language(ASM-ATT)
3-
# All subproject may use tests
3+
# Subproject may use tests
44
enable_testing()
55

66
# Obvious requirement
77
cmake_minimum_required(VERSION 3.4)
88

99
# Our project name
10-
project(the_core)
11-
12-
# C++14 is required
13-
set(CMAKE_CXX_STANDARD 14)
10+
project(the_core LANGUAGES C CXX)
1411

1512
include(build_api.cmake)
1613
include(Findcppcheck)
1714
include(CppcheckTargets)
1815

1916
# TODO: add same configuration mechanism for choosing right kernel
20-
message(STATUS "Checking [CONFIG_PLATFORM]...")
21-
if(NOT DEFINED CONFIG_PLATFORM)
22-
message(STATUS "CONFIG_PLATFORM is not set, defaulting to 'host'...")
23-
set(PLATFORM_NAME host)
17+
18+
message(STATUS "Checking [CONFIG_PLATFORM]: ${CONFIG_PLATFORM}")
19+
20+
if(NOT CMAKE_CROSSCOMPILING)
21+
if(DEFINED CONFIG_PLATFORM)
22+
if(NOT CONFIG_PLATFORM STREQUAL "host")
23+
message(FATAL_ERROR "Cross-compiler is required for platform other than 'host'.")
24+
endif()
25+
else()
26+
# It is fine to omit platform name if not cross-compiling
27+
message(STATUS "CONFIG_PLATFORM not set, defauluting to 'host'...")
28+
set(CONFIG_PLATFORM "host")
29+
endif()
30+
31+
# C++14 is required
32+
set(CMAKE_CXX_STANDARD 14)
2433
else()
25-
message(STATUS "Platform will be used: ${CONFIG_PLATFORM}")
26-
set(PLATFORM_NAME ${CONFIG_PLATFORM}) # For convinience
34+
# When cross-compiling, platform must be set explicitly.
35+
if(NOT DEFINED CONFIG_PLATFORM)
36+
message(FATAL_ERROR "CONFIG_PLATFORM must be set when cross-compiling")
37+
endif()
2738
endif()
2839

29-
# Set general flags for C\C++ compiler and linker
30-
set(CC_WARN_FLAGS "-Wall -Wextra -Wpedantic -Werror")
31-
set(CXX_WARN_FLAGS "${CC_WARN_FLAGS} -Weffc++")
40+
message(STATUS "Platform will be used: ${CONFIG_PLATFORM}")
3241

33-
set(CMAKE_C_FLAGS
34-
"${CMAKE_C_FLAGS} ${CC_WARN_FLAGS} ${CC_EXTRA_FLAGS}")
35-
set(CMAKE_CXX_FLAGS
36-
"${CMAKE_CXX_FLAGS} ${CC_WARN_FLAGS} ${CXX_EXTRA_FLAGS}")
42+
set(PLATFORM_NAME ${CONFIG_PLATFORM}) # For convinience
3743

3844
# Linker definitions is propagated by the platform.
3945
include(${CORE_DIR}/platform/common/linker.cmake)
4046

4147
# The top-level library target, essence of this project.
4248
add_library(${PROJECT_NAME} INTERFACE)
43-
target_link_libraries(${PROJECT_NAME} INTERFACE startup)
4449
target_link_libraries(${PROJECT_NAME} INTERFACE ${PLATFORM_NAME})
4550

46-
# In order to pick proper definitions from the platform it is required
47-
# that platform will be added in first place
51+
# Platform is added in the first place in order to expose platform definitions
52+
# to the rest of the system
4853
add_subdirectory(platform)
4954

5055
# Required layer only when cross-compiling
5156
if(CMAKE_CROSSCOMPILING)
5257
add_subdirectory(sys)
58+
set(CORE_PROVIDES_LIBC 1) # LibC routines provided by theCore.
5359
endif()
5460

5561
# Rest of modules
62+
add_subdirectory(arch)
5663
add_subdirectory(lib)
5764
add_subdirectory(dev)
5865
add_subdirectory(kernel)

README.md

+53-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# The Core: C++ Embedded Framework
1+
# theCore: C++ Embedded Framework
22

33
[![Build Status](https://travis-ci.org/forGGe/theCore.svg?branch=master)](https://travis-ci.org/forGGe/theCore)
44
[![Join the chat at https://gitter.im/forGGe/theCore](https://badges.gitter.im/forGGe/theCore.svg)](https://gitter.im/forGGe/theCore?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
55

66
## Description
77

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.
8+
theCore is highly configurable and straightforward C++ framework aimed to reduce development efforts for embedded applications.
9+
The main idea of theCore is to make as much as possible in the compile time.
1010
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.
11+
In fact, each driver is the template class that is instantiated with all the dependencies in a distinct type by user of theCore in the compile time.
1212

13-
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).
13+
You can check out more directly in the code of [the SPI driver](platform/stm32/export/aux/spi_bus.hpp) or [the USART bus](platform/stm32/export/aux/usart_bus.hpp).
1414

1515
The project is at the initial stage. But something is already in there:
1616
- CMake-based build-system
@@ -24,11 +24,11 @@ The project is at the initial stage. But something is already in there:
2424

2525
## Getting started
2626

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).
27+
If you are interested in the simplest, ready-made demo project based on theCore, refer to [the blinky example project](https://github.com/forGGe/theCore-blinky).
2828

2929
You may also check [examples within theCore source tree](examples/).
3030

31-
In order to proceed with The Core itself, start cloning this repository:
31+
In order to proceed with theCore itself, start cloning this repository:
3232
```
3333
git clone https://github.com/forGGe/theCore.git
3434
```
@@ -44,9 +44,29 @@ nix-shell --pure
4444
...
4545
```
4646

47+
## Examples
48+
49+
Examples reside in the [`examples`](examples) dir. Each example contains instructions how to compile and use the example.
50+
51+
To build all examples at once you can use nix and specially crafted [superproject](examples/CMakeLists.txt).
52+
To do that, [enter the nix shell](#getting-started) and proceed as follows.
53+
54+
```bash
55+
cd examples
56+
mkdir build
57+
cd build
58+
cmake ..
59+
make
60+
```
61+
62+
Resulting binaries will be placed under corresponding directories.
63+
I.e. the [cs43l22 example](examples/cs43l22_audio) if built that way, will be placed under `build/stm32f4_cs43l22_audio-prefix/src/stm32f4_cs43l22_audio-build/` directory.
64+
You can refer to the [external project CMake documetation](https://cmake.org/cmake/help/v3.4/module/ExternalProject.html) and [the superproject CMake list file](examples/CMakeLists.txt) to figure out where binaries will be placed.
65+
Instructions describing how to flash binary onto the device placed in the readme file inside each example.
66+
4767
## Unit tests
4868

49-
The Core's unit tests can be built and run on the host machine.
69+
theCore's unit tests can be built and run on the host machine.
5070
For this you have to run the nix-shell and trigger a build:
5171

5272
```bash
@@ -63,13 +83,32 @@ Then, you should run the unit tests:
6383
ctest . --output-on-failure
6484
```
6585

86+
## On-device tests
87+
88+
theCore comes with tests that can be executed on the device itself.
89+
Refer to [the theCore testing documentation](tests/README.md) to figure out how to build, use and manage on-device theCore tests.
90+
To build all tests, [enter the nix shell](#getting-started) and proceed as follows:
91+
92+
```bash
93+
cd tests
94+
mkdir build
95+
cd build
96+
cmake ..
97+
make
98+
```
99+
66100
## Supported platforms
67101

68-
Currently, the stm32f4xx platform is supported and available for further development, as well as the host-platform, used for unit tests.
102+
| Short name | Full name | List of supported MCUs | Path in project |
103+
|-----------|------------|------------------------|-----------------|
104+
| stm32f4xx | STM32 F4 series | STM32F407VG | [stm32 multiplatform](platform/stm32) |
105+
| stm32l1xx | STM32 L1 series | STM32L152RE | [stm32 multiplatform](platform/stm32) |
106+
| tm4c | Texas Instrument TM4C |TM4C123GH6PM | [platform/tm4c](platform/tm4c) |
107+
| host | Host platform | - | [platform/host](platform/host) |
69108

70109
## Documentation
71110

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

75114
```bash
@@ -87,8 +126,10 @@ The source code is distributed under LGPL v3.0 License.
87126

88127
The project is on its very beginning, so any help is more than welcome and highly appreciated.
89128
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.
129+
If you have any suggestions on theCore improvement or just like it how it is, don’t keep silence! I’ll be happy to read your reviews.
130+
131+
When making pull requests, make sure that code conforms to [theCore code style guide](style.md).
91132

92-
You are welcome to use The Core in your own projects.
133+
You are welcome to use theCore in your own projects.
93134
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.
94135
Good luck!

arch/CMakeLists.txt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# `arm_cm*` not an architectures, but ARM cores.
2+
# Still, it is better to threat them as `architecures` of some kind since
3+
# the `core` term is something that peculiar to ARM and collides with
4+
# the project name.
5+
6+
# Check if ARM Cortex-M core is requested
7+
if("${TARGET_MCU_ARCH}" MATCHES "^arm_cm")
8+
add_subdirectory(arm_cm)
9+
elseif("${TARGET_MCU_ARCH}" STREQUAL "") # Empty architecture allowed only when building for host
10+
if(NOT "${PLATFORM_NAME}" STREQUAL "host")
11+
message(FATAL_ERROR "Architecture is not set, abonring")
12+
endif()
13+
else()
14+
message(FATAL_ERROR "Unsupported architecture: ${TARGET_MCU_ARCH}")
15+
endif()

arch/arm_cm/CMakeLists.txt

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# ARM Cortex-M architecture
2+
add_library(arch STATIC startup_arm_cm.S)
3+
4+
# By default CMake do not pass compile definitions to ASM files.
5+
# Probably due to the fact that it depends on assembler used and some of the
6+
# assemblers may not support preprocessing.
7+
# This command forces use of gcc instead of as. It allows to pass compile definitions
8+
set_source_files_properties(startup_arm_cm.S PROPERTIES LANGUAGE C)
9+
10+
# ASM code requires some symbols present in outer libraries
11+
target_link_libraries(arch PRIVATE sys)
12+
target_compile_definitions(arch PRIVATE
13+
-D__START=core_main
14+
-D__STARTUP_CLEAR_BSS
15+
-DIRQ_COUNT=${TARGET_MCU_IRQ_COUNT})
16+
17+
# Apply memory layout
18+
configure_file(gcc_arm_cm.ld ${CMAKE_CURRENT_BINARY_DIR}/gcc_arm_cm.ld)
19+
20+
# Use linker script
21+
target_link_libraries(arch PUBLIC -T${CMAKE_CURRENT_BINARY_DIR}/gcc_arm_cm.ld)
22+
23+

0 commit comments

Comments
 (0)