Code Generation Concept

In order to suit the actual needs of the developer, the embedded software modules of the redBocks Component Library can be configured in many respects. Nevertheless, this flexibility does not introduce any runtime penalties, because the configuration options are evaluated during compile-time and do not result in any runtime effects at all (like increased memory consumption, additional processor time …).

For this to work, virtually all redBlocks Software Components are designed as configurable code templates that are used to generate highly optimized machine code during compile time. Via their configuration options, the software developer may tailor the redBlocks components both in terms of desired functionality as well as the characteristics of the target platform.

 

Code Generation Concept

 

Compiler-based Code Generation

This code generation mechanism does not require any proprietary tools. Instead, it relies on the powerful and standardized code generation features of modern C++ compilers. Thus, the redBlocks Component Library offers an extensive set of C++ templates that can be configured to the needs of the application and are specifically designed for resource-limited embedded systems.

Why C++?

Some people may wonder whether C++ is the right implementation language for low-resource embedded platforms. Be assured, it is! Because the programming language C++ does not introduce any overhead whatsoever compared to C – as long as no dynamic polymorphism or exceptions are used.

However, with its powerful template mechanism, it can be used to generate highly optimized code (even suitable for 8 bit microcontrollers) from flexible software components.

The redBlocks Component Library differs considerably from other C++ libraries like the Standard Template Library (STL) or Boost:

  • First, it does not require exception handling or rely on dynamic memory allocation during runtime.
  • Second, besides standard functionality like collections and container classes it covers typical application level functionality that is often required in embedded devices.