distortos

object-oriented C++ RTOS for microcontrollers
授权协议 MPL-2.0 License
开发语言 C/C++
所属分类 其他开源、 嵌入式操作系统
软件类型 开源软件
地区 不详
投 递 者 艾心远
操作系统 嵌入式
开源组织
适用人群 未知
 软件概览

distortos

object-oriented C++ RTOS for microcontrollers

Homepage
Documentation
Source Code @ GitHub
Forum

Build Test
Test Board Generator
Unit Tests

Configuration & building

To configure & build distortos you need:

distortos tries to follow typical CMake cross-compiling workflow, which means that you always have to use aso-called toolchain file. Toolchain files in distortos also serve another purpose - they select the board which isgoing to be used by your application.

  1. Download source package of distortos in zip ortar.gz format and extract it;
  2. Create a build folder, for example output;
  3. From within the build folder, initialize it with CMake, for example withcmake .. -DCMAKE_TOOLCHAIN_FILE=../source/board/ST_STM32F4DISCOVERY/Toolchain-ST_STM32F4DISCOVERY.cmake -GNinja if youwant a default configuration orcmake -C../configurations/ST_STM32F4DISCOVERY/test/distortosConfiguration.cmake .. -GNinja if you want to start from asaved configuration;
  4. Edit distortos configuration with a tool of your choice, for example cmake-gui .. (a GUI application) orccmake .. (curses-based application);
  5. Execute selected build tool, for example ninja or ninja -v if you want to see all command lines while building;

You can obviously replace step 1 with git clone https://github.com/DISTORTEC/distortos.

Steps 2-4 can be all done from within cmake-gui. After starting the application use Browse Source... button toselect the folder with distortos and Browse Build... button to select the build folder. Then click on Configurebutton. In the CMakeSetup window which appears select the generator of your choice and make sure thatSpecify toolchain file for cross-compiling is selected before going any further. Click Next and specify thetoolchain file (which also selects the board), for example<source-folder>/source/board/ST_STM32F4DISCOVERY/Toolchain-ST_STM32F4DISCOVERY.cmake and click Finish button.

Test application

The default target of build - all - is just the static library with distortos libdistortos.a. If you want to buildthe test application, specify distortosTest as the target (for example ninja distortosTest if you use Ninja).

tl;dr

$ wget https://github.com/DISTORTEC/distortos/archive/master.tar.gz
$ tar -xf master.tar.gz
$ cd distortos-master
$ mkdir output
$ cd output
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../source/board/ST_STM32F4DISCOVERY/Toolchain-ST_STM32F4DISCOVERY.cmake -GNinja
$ cmake-gui ..
$ ninja

or

$ wget https://github.com/DISTORTEC/distortos/archive/master.tar.gz
$ tar -xf master.tar.gz
$ cd distortos-master
$ mkdir output
$ cd output
$ cmake -C../configurations/ST_STM32F4DISCOVERY/test/distortosConfiguration.cmake .. -GNinja
$ cmake-gui ..
$ ninja

Generating board

To generate a board you need:

  • Python (version 2.7, version 3.6 or later);
  • Jinja2 template engine for Python (version 2.10 or later);
  • ruamel.yaml YAML loader/dumper package for Python;

Both Jinja2 and ruamel.yaml can be easily installed with pip install jinja2 && pip install ruamel.yaml (orpython -m pip install jinja2 followed by python -m pip install ruamel.yaml on Windows), however they may also beavailable in the package manager of your system.

Board generator - scripts/generateBoard.py - takes a *.yaml file as an input and produces a folder containingvarious board files: source files, headers, CMake files (including CMake toolchain file) and so on. The input*.yaml file describes the board hardware in a tree-like form. The idea is very close to devicetree and in factearlier versions of board generator used devicetree files.

To get an idea about the format of the board YAML files, take a look at some of the existing files, for examplesource/board/ST_STM32F4DISCOVERY/ST_STM32F4DISCOVERY.yaml - which describes STM32F4DISCOVERY board from ST - orsource/chip/STM32/STM32F4/chipYaml/ST_STM32F407VG.yaml - which describes STM32F407VG chip used on this board. Thereis also some documentation about YAML bindings in documentation/yaml-bindings

Assuming that you already have distortos either as part of your project or as a standalone folder, the basicinvocation of the board generator is just path/to/distortos/scripts/generateBoard.py path/to/board.yaml (orpython path/to/distortos/scripts/generateBoard.py path/to/board.yaml on Windows), for example./scripts/generateBoard.py source/board/ST_STM32F4DISCOVERY/ST_STM32F4DISCOVERY.yaml. You may also generate so-calledraw-boards, using chip YAML file as the input directly, for example./scripts/generateBoard.py source/chip/STM32/STM32F4/chipYaml/ST_STM32F407VG.yaml -o output/path/of/raw/board.

相关阅读

相关文章

相关问答

相关文档