• Stars
    star
    179
  • Rank 214,039 (Top 5 %)
  • Language
    C++
  • License
    Other
  • Created about 10 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Embedded Multicore Building Blocks (EMB²): Library for parallel programming of embedded systems. Star us on GitHub? +1

Build Status Coverity Scan Status CII Best Practices

Embedded Multicore Building Blocks (EMB²)

Introduction

Overview

The Embedded Multicore Building Blocks (EMB²) are an easy to use yet powerful and efficient C/C++ library for the development of parallel applications. EMB² has been specifically designed for embedded systems and the typical requirements that accompany them, such as real-time capability and constraints on memory consumption. As a major advantage, low-level operations are hidden in the library which relieves software developers from the burden of thread management and synchronization. This not only improves productivity of parallel software development, but also results in increased reliability and performance of the applications.

EMB² is independent of the hardware architecture (x86, ARM, ...) and runs on various platforms, from small devices to large systems containing numerous processor cores. It builds on MTAPI, a standardized programming interface for leveraging task parallelism in embedded systems containing symmetric or asymmetric (heterogeneous) multicore processors. A core feature of MTAPI is low-overhead scheduling of fine-grained tasks among the available cores during runtime. Unlike existing libraries, EMB² supports task priorities and affinities, which allows the creation of soft real-time systems. Additionally, the scheduling strategy can be optimized for non-functional requirements such as minimal latency and fairness.

Besides the task scheduler, EMB² provides basic parallel algorithms, concurrent data structures, and skeletons for implementing stream processing applications (see figure below). These building blocks are largely implemented in a non-blocking fashion, thus preventing frequently encountered pitfalls like lock contention, deadlocks, and priority inversion. As another advantage in real-time systems, the algorithms and data structures give certain progress guarantees. For example, wait-free data structures guarantee system-wide progress which means that every operation completes within a finite number of steps independently of any other concurrent operations on the same data structure.

Building blocks of EMB²

Important Links

Website:

GitHub:

Repository:

Mailing list:

Community (help, bug reports, etc.):

Contact:

License

See the file COPYING.md in the project's root directory.

Contributions

See the file CONTRIBUTING.md in the project's root directory.

Build and Installation

General

It is strongly recommended to build from a release file and not from a repository snapshot in order to get the documentation and the examples out-of-the box. The release files can be found at https://github.com/siemens/embb/releases.

Platforms

EMB² is regularly built and tested on a variety of OS/compiler/architecture combinations including Linux (x86 and ARM using GCC/Clang) and Windows (x86 using MSVC). Moreover, it has been successfully built and tested on RTEMS and FreeBSD. Other platforms may be supported without any changes to the source code. The included unit tests can be used to find out whether a system not officially supported is suitable to run EMB². If the build process or the unit tests fail on your system, please contact us.

Prerequisites

The project is based on the standards C99 (for C code) and C++03 (for C++ code) to be usable on a wide range of target systems. Besides a C/C++ compiler supporting these standards, CMake 2.8.9 or higher is required to build EMB² (CMake is a build file generator which abstracts from the concrete build tools). It is possible to select the standards C11 (for C code) and C++11 (for C++ code) to enable the use of standard provided atomic operations.

Quick Installation on Linux

To generate and invoke the platform-specific build files, open a shell and change to the project's root directory. Create a subdirectory, where you want to build the library, e.g., "build", and change to that subdirectory. In the following, it is assumed that the project's root directory is the parent directory. Now you can generate the build files using CMake:

cmake ..

As the next step, compile EMB²:

cmake --build .

After compilation has finished, execute the tests:

binaries/run_tests.sh

Finally, install EMB² (the default path is /usr/local):

sudo cmake --build . --target install

Quick Installation on Windows

To generate and invoke the platform-specific build files, open a Developer Command Prompt for Visual Studio and change to the project's root directory. Create a subdirectory, where you want to build the library, e.g., "build", and change to that subdirectory. In the following, it is assumed that the project's root directory is the parent directory. Now you can generate the build files using CMake (a list of supported CMake generators can be displayed by typing cmake --help). For example:

cmake -G "Visual Studio 14 2015" ..

As the next step, compile EMB²:

cmake --build . --config Release

After compilation has finished, execute the tests:

binaries\run_tests.bat

Finally, install EMB² with administrator privileges:

cmake --build . --target install --config Release

Detailed Installation Instructions

EMB² provides several options which allow you to configure it to your needs. This section explains these options and describes the build process in more detail.

1. Generation of Native Build Files

As mentioned above, it is recommended to build EMB² in a subdirectory such as "build". The actual build files are generated by the following command (a list of available generators can be displayed by typing cmake --help):

cmake -G <generator> .. [OPTIONS]

Note that on Linux, the architecture (32/64 bit) cannot be selected by the generator. The default is "Unix Makefiles" for which reason -G <generator> may be omitted.

To select the C11 and C++11 standards use:

 cmake .. -DUSE_C11_AND_CXX11=ON

EMB² can be built in Release or Debug mode. The latter contains additional checks during runtime and is only recommended for development purposes. On Linux, the build mode can be specified using the option -DCMAKE_BUILD_TYPE=[Release|Debug], for example:

cmake .. -DCMAKE_BUILD_TYPE=Debug

If no build mode is given, the default (Release) is used. The Visual Studio generators create build files for both modes (the selection is done at build time as described below).

You may choose a custom compiler instead the default one by defining CMAKE_CXX_COMPILER and/or CMAKE_C_COMPILER. For example, to use Clang on Linux, type:

cmake .. -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang

In the same way, you may cross compile to another platform. For example, to cross compile to ARM v7 using GCC, you need to specify the cross compiler itself and the target architecture as an argument to the compiler:

cmake .. -DCMAKE_CXX_COMPILER=arm-linux-gnueabi-gcc++ \
         -DCMAKE_CXX_FLAGS=-march=armv7-a \
         -DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc \
         -DCMAKE_C_FLAGS=-march=armv7-a

EMB² can be built with C++ exception handling (default) or without exceptions. When exceptions are turned off, a message is emitted in case of an error and the program aborts. To disable exceptions, add the option -DUSE_EXCEPTIONS=OFF.

Similarly, automatic initialization of the task scheduler by the MTAPI C++ interface can be disabled with -DUSE_AUTOMATIC_INITIALIZATION=OFF. This way, unexpected delays after startup can be avoided, e.g. for timing measurements.

EMB² comes with OpenCL and CUDA plugins to support execution on GPUs that may be built by setting -DBUILD_OPENCL_PLUGIN=ON and -DBUILD_CUDA_PLUGIN=ON, respectively. The CUDA build process requires an installed CUDA SDK.

If multiple applications use EMB², it might be desireable to build shared libraries by specifying -DBUILD_SHARED_LIBS=ON.

Furthermore, EMB² can be built to work with threading analysis tools such as Helgrind or ThreadSanitizer with -DTHREADING_ANALYSIS_MODE=ON. This uses mutexes around atomics to avoid false positives and degrades performance significantly.

Warnings can be treated as errors by the option -DWARNINGS_ARE_ERRORS=ON.

The tutorial of EMB² comes with a number of examples in doc/examples/. These can be built using the option -DBUILD_EXAMPLES=ON. Note, however, that the examples use C++11 features and require an appropriate compiler.

The documentation may be built by setting -DBUILD_DOCUMENTATION=ON if Doxygen is installed.

By default, the included unit tests are built as part of the installation process. To override the default behavior, add the option -DBUILD_TESTS=OFF.

2. Compiling and Linking

As the next step, you can compile the library using the generated build files. On Linux, the build mode (Release|Debug) is already given in the build files, whereas on Windows, it has to be specified now.

For a Linux build, type

cmake --build .

For a Windows Release build, type

cmake --build . --config Release

If you are a developer working on a repository snapshot of EMB², you can build the documentation as follows (provided that you have Doxygen installed):

cmake --build . --target doxygen

Note that this is not necessary if you build from a release file.

3. Running the Tests

To check whether EMB² was compiled correctly, run the tests. The test executables are contained in the subfolder "binaries".

On Linux, type

binaries/run_tests.sh

On Windows, type

binaries\run_tests.bat

If no error message occurs, EMB² works fine.

4. Installation

The default installation path on Linux is

/usr/local/

and on Windows

C:\Program Files\embb-X.Y.Z\

or

C:\Program Files (x86)\embb-X.Y.Z

depending on the target architecture.

If you want a different installation path, you can change it now by typing

cmake -DINSTALL_PREFIX=YourCustomPath ..

To install the files, use the command

cmake --build . --target install

which copies the contents of the "install" folder to the "bin", "lib", and "include" folders in the installation path. For the default paths, the installation has to be run with administrator / root privileges.

Using the Library

Components

For some of the components, there exist C and C++ versions, wheras others are only implemented in C++. The directory names are postfixed with either "_cpp" or "_c" for the C++ and C versions, respectively. Currently, EMB² is composed of the following components:

  • Base library: base_c, base_cpp
  • MTAPI: mtapi_c, mtapi_cpp, and mtapi_plugins_c (mtapi_network_c, mtapi_opencl_c, mtapi_cuda_c)
  • Algorithms: algorithms_cpp
  • Dataflow: dataflow_cpp
  • Containers: containers_cpp

Directory "base_c" contains abstractions for threading, synchronization, atomic operations, and other functionalities. As the name indicates, the code is implemented in C. Directory "base_cpp" contains C++ wrappers around the "base_c" functions. Similarly, the MTAPI task scheduler is available for programs written in C ("mtapi_c") or C++ ("mtapi_cpp"). Heterogeneous and distributed systems are supported via the plugins contained in "mtapi_plugins_c". Directory "algorithms_cpp" provides high-level constructs for typical parallelization tasks in C++, and "dataflow_cpp" generic skeletons for the development of parallel stream-based applications. Finally, "containers_cpp" provides data structures for storing objects in a thread-safe way.

Using C++

If you want to use the C++ functionalities of EMB², you have to link the following libraries (names will be slightly different on Windows and on Linux) in the given order:

embb_dataflow_cpp, embb_algorithms_cpp, embb_containers_cpp, embb_mtapi_cpp, embb_mtapi_c, embb_base_cpp, embb_base_c

The C++ header files can be included as follows:

#include <embb/base/base.h>
#include <embb/mtapi/mtapi.h>
#include <embb/containers/containers.h>
#include <embb/dataflow/algorithms.h>
#include <embb/dataflow/dataflow.h>

Using C

If you only want to use the C versions of MTAPI and the base library, link them in the following order:

embb_mtapi_c, embb_base_c

The C header files can be included as follows:

#include <embb/base/c/base.h>
#include <embb/mtapi/c/mtapi.h>

Alternatively, you can include MTAPI by #include <mtapi.h>.

Integration using CMake

If you are using CMake for your application, integration of EMB² is easy. After installing EMB², the installation folder contains a CMake folder with a simple finder which is used as follows:

find_package(EMBB REQUIRED NO_MODULE)
include(${EMBB_USE_FILE})

After that, you can link the libraries by name (embb_base_c, embb_mtapi_c, etc.) and the include directories are set up as described above.

If EMB² was not installed to the default directory, you have to specify the directory of the CMake script before using find_package:

set(EMBB_DIR ${your_install_directory}/CMake)

Documentation

The release files of EMB² come with a tutorial, example programs, and a reference manual describing the APIs. All documentation is contained in the "doc" folder. The root document of the reference manual (HTML) is doc/reference/index.html. Note that the generated documentation files are not under version control and hence not contained in the repository. As mentioned above, it is therefore recommended to download one of the packaged release files in order to have ready-to-use documentation.

Limitations and Important Notes

  • For memory management reasons, the number of threads EMB² can deal with is bounded by a predefined but modifiable constant (see functions embb_thread_get_max_count() / embb_thread_set_max_count() and class embb::base::Thread).
  • The MTAPI C++ interface supports automatic initialization, which allows for easy usage of the MTAPI C++, Algorithms, and Dataflow components. For performance measurements, explicit initialization is strongly recommended since the measurements will otherwise include the initialization time of MTAPI.
  • When using ThreadSanitizer, a bug causes the built-in CMake type size determination to fail which in turn leads to a broken configuration. Therefore, you have to do a normal build first and then run CMake again with flags and libs configured for ThreadSanitizer.
  • Compilation with option -DUSE_C11_AND_CXX11=ON to enable C11/C++11-based atomics has no effect with MSVC.

More Repositories

1

jailhouse

Linux-based partitioning hypervisor
C
1,720
star
2

ros-sharp

ROS# is a set of open source software libraries and tools in C# for communicating with ROS from .NET applications, in particular Unity3D
C#
956
star
3

kas

Setup tool for bitbake based projects
Python
358
star
4

edgeshark

Discover and capture container network traffic from your comfy desktop Wireshark, using a containerized service and a Wireshark plugin.
Markdown
244
star
5

confluence-dumper

Tool to export Confluence spaces and pages recursively via its API
Python
194
star
6

ix

Siemens Industrial Experience is a design system for designers and developers, to consistently create the perfect digital experience for industrial software products.
TypeScript
190
star
7

meta-iot2050

SIMATIC IOT2050 Isar/Debian Board Support Package
Python
130
star
8

meta-iot2000

SIMATIC IOT2000 Yocto Board Support Package
C
127
star
9

industrialbenchmark

Industrial Benchmark
Java
123
star
10

efibootguard

Simple UEFI boot loader with support for safely switching between current and updated partition sets
C
100
star
11

fluffi

FLUFFI (Fully Localized Utility For Fuzzing Instantaneously) - A distributed evolutionary binary fuzzer for pentesters
C++
99
star
12

simatic-s7-webserver-api

A .NET API Client Library for the SIMATIC S7 PLC Webserver API
C#
97
star
13

powergym

A Gym-like environment for Volt-Var control in power distribution systems.
Python
70
star
14

policy_search_bb-alpha

Python
69
star
15

codeface

Codeface is a framework for analysing technical and social aspects of software development
R
67
star
16

jailhouse-images

Jailhouse demonstration and testing images
C
56
star
17

linux-entra-sso

Browser plugin for Linux to SSO on Microsoft Entra ID using a locally running microsoft identity broker (Intune).
JavaScript
49
star
18

freertos-cell

FreeRTOS for Jailhouse Cells
C
47
star
19

dtasm

Digital Twin Assembly - A portable and sandboxed package format for executable simulation modules based on WebAssembly
Rust
39
star
20

wfx

a lightweight, general-purpose workflow executor
Go
37
star
21

sourcegrid

sourcegrid
C#
36
star
22

mtda

Multi-Tenant Device Access
Python
35
star
23

cshargextcap

[Edgeshark] Wireshark extcap plugin for container traffic capture live streaming.
Go
30
star
24

pycontainerd

Python bindings for containerd API
Python
30
star
25

restapidoc

A RESTful API documentation plugin for the Grails web application framework
Groovy
28
star
26

ix-icons

Icon library for @siemens/ix
TypeScript
25
star
27

opc-ua-pubsub-dotnet

opc-ua-pubsub-dotnet is a library which implements OPC UA PubSub encoding and decoding in a simplified way.
C#
25
star
28

continuous-clearing

The Continuous Clearing Tool scans and collects the 3rd party OSS components used in a NPM/NuGet/Debian/Maven/Python/Conan/Aipine project and uploads it to SW360 and Fossology by accepting respective project ID for license clearing.
C#
23
star
29

libuta

Unified Trust Anchor Library
C
20
star
30

xenomai

Mirror of xenomai-forge for pull requests
C
20
star
31

siapp-sdk

Software Development Kit to build SIAPPs
C++
20
star
32

ix-blazor

Siemens IX library for Blazor
CSS
19
star
33

cvss-suite

CvssSuite - This Ruby gem helps you to process the vector of the Common Vulnerability Scoring System.
Ruby
18
star
34

GoScans

Collection of network scan modules for infrastructure discovery and information gathering.
Go
17
star
35

Large-Scale-Discovery

A network scanning solution for information gathering in large IT/OT network environments.
Go
16
star
36

u-boot

U-Boot
C
16
star
37

JMiniZinc

JMiniZinc
Java
15
star
38

CtrlppCheck

C++
14
star
39

simatic-ai-launcher

Get started with the toolbox of SIMATIC Artificial Intelligence Launcher.
Python
14
star
40

sparring

Network simulation for malware analysis.
Python
13
star
41

dfu-util

Device Firmware Upgrade Utilities
C
12
star
42

packetflix

[Edgeshark] container "binge watching" live packet streams for Wireshark(nado) nerds!
Go
11
star
43

pydcc

PyDCC is a software library for reading and automated processing of digital calibration certificates (DCCs).
Python
11
star
44

gencmpclient

generic CMP [RFC 4210, RFC 9483] client library and CLI, based on CMPforOpenSSL (https://github.com/mpeylo/cmpossl)
C
10
star
45

LightweightCmpRa

CLI-based Registration Authority application PoC
Java
10
star
46

ghostwire

[Edgeshark] Virtual communication discovery in container hosts
TypeScript
9
star
47

link-checker-service

The self-hosted Link Checker web service runs cached and otherwise optimized broken link checks
Go
8
star
48

meta-coral

ISAR Layer for Coral TPU
Smarty
7
star
49

OOASP

Jupyter Notebook
7
star
50

meta-efibootguard

Yocto layer for EFI Boot Guard
Python
7
star
51

evaluation-framework

Tools for specifying and evaluating many variants of a (Unity) simulation model and visualizing the results in a decision support system.
C#
7
star
52

isar-riscv

Isar layer to support RISC-V architecture for QEMU and also for upcoming NOEL-V hardware within SELENE EU project
Shell
6
star
53

tstomp

tStomp
Tcl
6
star
54

omniproperties

Think of java properties deluxe
Java
6
star
55

cyclonedx-property-taxonomy

CycloneDX Property Taxonomy for the 'siemens' namespace
6
star
56

spdx-licenselist

SPDX license list
5
star
57

libsecutils

Wrapper library for commonly used OpenSSL features, providing a simpler, more application-oriented API.
C
5
star
58

sicam-gridedge-configurationtemplates

this is a collection of templates which can be used in SICAM GridEdge product in order to collect data (measurements/asset information data) and publish the data to a cloud system.
5
star
59

cityhub-sdk

CityHub SDK
JavaScript
5
star
60

sinema-rc-tools

This repository contains tooling for the SINEMA-RC solution of Siemens.
Python
5
star
61

snap-to-bucket

A python tool to automate moving AWS snapshots into an AWS S3 bucket and restore backups from there as an AWS EBS volume.
Python
5
star
62

modular-application-creator-use-cases

HTML
5
star
63

tia-addin-build-package

4
star
64

csharg

[Edgeshark] client and CLI to packet capture streaming API
Go
4
star
65

turtlefinder

reusable container engine discovery, not only for Edgeshark
Go
4
star
66

embeddedCMP

proof-of-concept CMP client on the NXP FRDM-K64F platform
C
4
star
67

ix-starter

Siemens Industrial Experience is a design system for designers and developers, to consistently create the perfect digital experience for industrial software products.
TypeScript
4
star
68

androit_shmem

Androit: Real-time capable Android shared memory service
C++
3
star
69

cmp-ra-component

A CMP Registration Authority (RA)
Java
3
star
70

mkdocs-siemens

3
star
71

android-x86-siemens

Android-x86 build configuration for Siemens products, for upstream see http://git.android-x86.org/?p=device/siemens.git
Shell
3
star
72

k3-rti-wdt

RTI Watchdog Firmware for TI K3 SoCs
Assembly
3
star
73

vanilc

C++
2
star
74

.github

2
star
75

ProductConfigurationWithSHACL

Example code and models for a paper published at the Configuration Workshop 2018
Java
2
star
76

fact

fact
Python
2
star
77

lion

Code to reproduce experiments from "User-Interactive Offline Reinforcement Learning" (ICLR 2023)
Python
2
star
78

python-smime-email

Generate x509 SMIME signed emails with ease!
Python
2
star
79

simatic-s7-1500-tm-fast-vhdl-application-examples

VHDL Examples for the S7-1500 TM FAST Module from SIEMENS AG
VHDL
2
star
80

ASLanPPConnector

ASLan++ connector
Java
1
star
81

ix-docs

1
star
82

M-Fit

the M-Fit suite, a set of programs for testing and validating traffic controllers against the various ITE/AASHTO/NEMA ATC and Caltrans TEES 2009 standards
C
1
star
83

django-mantis-core

A wrapper around the Django Dingos app for the Mantis Cyber Threat Intelligence Mgmt. Framework.
Python
1
star
84

OOCSP

OOCSP
1
star
85

puppet-pam_pkcs11

A Puppet module to manage pam_pkcs11
Ruby
1
star
86

continuous-conformance

Azure DevOps extension to create automatically conformance work items.
TypeScript
1
star