Contents of This Book

This document introduces several concepts that can be used in bare-metal development as well as shows how they can be implemented using features of latest (at the time of writing) C++11 standard.

The code of generic components is implemented as part of “Embedded C++ Library” project called “embxx” and can be found at https://github.com/arobenko/embxx. It has GPLv3 licence.

There is also a project that implements multiple simple bare metal applications using embxx which can run on RaspberryPi platform. The source code can be found at https://github.com/arobenko/embxx_on_rpi. It also has GPLv3 licence.

Both projects require gcc version 4.7 or higher, because of C++11 support requirement. They also use CMake as their build system. The code has been tested with following free toolchains:

The whole document is ARM platform centric. At this moment I do not try to cover anything else.

To compile Raspberry Pi example applications in Linux environment use the following steps: 1. Checkout embxx_on_rpi project

    > git clone https://github.com/arobenko/embxx_on_rpi.git
    > cd embxx_on_rpi
  1. Create separate build directory and cd to it

     > mkdir build
     > cd build
  2. Generate makefiles

     > cmake ..

    Note that last parameter to cmake is relative or absolute path to the root of the source tree.

    Also note that embxx library will be checked out as external git submodule during this process.

  3. Build the applications

     > make
  4. Take the generated image from <build_dir>/image/<app_name>/kernel.img

The CMake provides the following build types, which I believe are self-explanatory:

  • None (default)

  • Debug

  • Release

  • MinSizeRel

  • RelWithDebInfo

To specify the required build type use -DCMAKE_BUILD_TYPE=<value> option of cmake utility:

cmake -DCMAKE_BUILD_TYPE=Release ..

If no build type is specified, the default one is None, which is similar to Debug, but without “-g” compilation option, i.e. no optimisations and no debugging information is generated.

It is possible to specify the cross-compilation toolchain prefix. By default arm-none-eabi- is expected, i.e. arm-none-eabi-gcc, arm-none-eabi-g++ and arm-none-eabi-as are used to compile the sources. If these utilities cannot be found in environment search paths, then you should specify the prefix passing -DCROSS_COMPILE=<prefix> option to cmake:

cmake -DCROSS_COMPILE=/opt/arm-none-eabi-2013.05/bin/arm-none-eabi- ..

To see the commands used to compile the sources, prefix make with VERBOSE=1:

VERBOSE=1 make

The embxx library has doxygen generated documentation. It can be found here.

Last updated