Portable framework for developing reactive embedded systems in C
- Project web page: http://flplv.github.io/reacto/
- Change Log: https://github.com/flplv/reacto/releases
- Project Planning: https://github.com/flplv/reacto/wiki/0.-Planning
- Project Wiki: https://github.com/flplv/reacto/wiki
- react.o
- Links
- Table of Content
- Project Structure
- How to Build
- The build system
- Continuous Integration and Coverage Report Page
.
├── **build_platforms**
│ In this folder you will find the platforms definitions in
│ Python/SCons. Each platform extends the class
│ `PlatformBaseClass`. To add a new platform support, this is
│ the only place you have to edit.
│
├── **dependencies**
│ │ Only for dependency project, no application code here,
│ │ projects in this folder will not be considered on coverage
│ │ reports.
│ │ All projects inside this folder will be built into static
│ │ libraries for each related platform.
│ │
│ └── **cpputest**
│ │ CppUTest is the test framework we are using, build scripts
│ │ will download and build it here. CppuTest's libraries are
│ │ created for each platform that tests will run.
│ │ All projects built for tests include headers and libraries from
│ │ here.
│ │
│ ├── *include/generated/CppUTestGeneratedConfig.h*
│ │ This file configures the CppUTest build, it is shared between
│ │ all platform builds.
│ │
│ └── *setup-cpputest.sh*
│ This is the script responsible to download and decompress
│ CppUTest source.
│
├── **reacto**
│ │ Finally the application code. No tests allowed here, nor
│ │ platform dependent code, only application. Every dependency to
│ │ external world must be abstracted in order to have a testable
│ │ project.
│ │ This project will generate a library that will be linked against
│ │ tests builds and final builds.
│ │
│ ├── *src*
│ │ │ Here goes the source code of the application.
│ │ │
│ │ ├── *reusables*
│ │ │ Every project has reusable modules, such as checks, logs,
│ │ │ FIFOs, etc. This is no different.
│ │ │
│ │ └── *watchdog*
│ │ This is an extended example of a Software Watchdog Class created
│ │ to provide diversified and safe watchdogs along the firwmare.
│ │ A hardware watchdog will reboot by the expiration of any soft
│ │ one.
│ │
│ └── *includes*
│ The include tree, has the same folders as the source tree. Files
│ are thought to be public, include this folder in your project.
│
├── **reacto_tests**
│ │ Finally our application tests. This project will create
│ │ executables for each platform where tests will run.
│ │ There are test code supposed to run on a platform but not on the
│ │ others, this is why you have a source folder for each platform
│ │ and one that will have tests that run on every platforms.
│ │ Each sub folder of *reacto_tests* is equivalent of the *src*
│ │ folder of the application. It means that, if you are testing a
│ │ pattern, the test code will be at *platform_X/patterns/*.
│ │
│ ├── *platform_host_tests*
│ │ Test code that will run only on development platform, your
│ │ computer.
│ │
│ └── *tests*
│ Test code that will run only on every platform.
│
└── *README.md*
This README :)
1. Install Dependencies
- GCC (The compiler)
- scons (The build generator used)
- wget (To download dependency source code)
- lcov (To generate code coverage reports)
In ubuntu:
sudo apt-get install build-essential scons wget lcov
2. Build and run Tests
Inside the project root, this line will build the test executable reacto_host_tests
in the folder ./reacto_tests/build
:
scons -Q ./reacto_tests/build/reacto_host_tests
You can run tests with:
./reacto_tests/build/reacto_host_tests
3. Generate and open code coverage
To generate code coverage and open in firefox:
scons -Q coverage
firefox ./coverage/index.html
If you need to know what targets are available to build:
scons -Q
There are many ways to cross build react.o, one way is copying the code to your project, and the other is to add a new platform to react.o's build system.
- Copy folder
reacto/include
andrecto/src
to your project - Add the
include
folder to the compiler search path (-I include
) - Now enable the GNU extensions with the gcc (or equivalent) flag
-std=gnu11
You should now be able to build the your application successfully.
react.o uses Scons, a Python based build system, and created an expansible build system where you can add one more platform considerably easy.
Platforms are defined in the folder build_platforms
,
there you can find a few platform configured:
msp430.sconscript
defines a platform for the MSP430 chip, it is used to build the examples.host_tests.sconscript
is a platform used during development, it build and run all react.o's tests.
To create another platform, it is recommended to copy one of the available and setup:
- The python class name;
- The platform name returned in the
Name()
method; - Define your own targets and return it in
TargetNameList()
; - Set what projects will be built with your platform in the list returned by
BuildList()
; - Choose
ProfileEnabled
andCppUTestExtensionsEnabled
status; - Create your
PostBuildTargets()
Commands - Clone and setup your enviroment in
_SetupEnv()
, and finally; - Use the new class when creating an instance at the end of the file.
To be described