Modern C++ for Embedded Systems

Course category
Training area
Course code
5 days
Course date
Price exc VAT

C++ is a remarkably powerful systems-programming language, combining multiple programming paradigms – Procedural, Object Oriented and Generic – with a small, highly-efficient run-time environment. This makes it a strong candidate for building complex high-performance embedded systems.

The C++11 standard marked a fundamental change to the C++ language, introducing new idioms and more effective ways to build systems.  This new style of programming is referred to as ‘Modern C++’.

This practical, hands-on course introduces the C++ language for use on resource-constrained, real-time embedded applications.

The course highlights areas of concern for real-time and embedded development. The focus is on developing effective, maintainable and efficient C++ programs.


A five-day course that provides a practical overview of C++ focusing on developing object-oriented programs in an embedded, real-time environment.

Course objectives:

  • To provide a solid understanding of the essentials of the C++ programming language.
  • To give you practical experience of writing Modern C++ for resource-constrained real-time and embedded systems.
  • To give you the confidence to apply these new concepts to your next project.

Delegates will learn:

  • Modern C++ syntax and semantics and idioms
  • Using C++ for hardware manipulation
  • The Application Binary Interface (ABI) and memory model of C++
  • Idioms and patterns for building effective C++ programs
  • Real-time and concurrency design issues


  • A strong working knowledge of C
  • Embedded development skills are useful, but not essential

Who should attend: 

This course is aimed at C programmers who are moving to C++ for their embedded development.


  • Five days

Course materials:

  • Delegate manual
  • Delegate workbook
  • Delegate datakey

Course workshop:

Attendees perform hands-on embedded programming, on target hardware, during course practicals. Approximately 50% of the course is given over to practical work.

The board targeted is an ARM Cortex-M based MCU which gives attendees a real sense of embedded application development.

Hello World!

  • How C++ relates to C
  • I/O mechanisms

Program structure

  • Hello World!
  • The C++ build process

Stream I/O

  • Stream objects
  • Stream modifiers

The C++ object model

  • Scalar types
  • automatic type-deduction
  • Brace initialisation syntax
  • Scope and lifetime
  • The C++ memory model


  • constexpr objects
  • constexpr functions
  • static assert
  • enum classes


  • Pointer syntax and semantics
  • Initialising and using pointer

Hardware manipulation

  • Using pointers for I/O access
  • Bit manipulation
  • The volatile qualifier


  • Function call ABIs
  • References
  • In, Out and In-Out parameters
  • Named Return Value optimisation

Structuring code

  • Header files
  • Include guards
  • Linking to C code


  • Problems with organising large code bases
  • Namespaces 
  • Namespace resolution issues

Structures and tuples

  • Structure alignment, padding and packing
  • std::pair
  • std::tuple
  • Using tuples for multiple return values


  • Problems with C arrays
  • std::array
  • Iterators
  • The range-for statement
  • An introduction to Standard algorithms

Introduction to Object Oriented Design

  • Modularisation
  • Coupling, Cohesion, Encapsulation and Abstraction
  • Object-based design concepts
  • The client-server model

User-defined types

  • Classes
  • Attributes and operations
  • Member functions and the ‘this’ pointer

Initialising objects

  • Non-static data member initialisers
  • Constructors and destructors
  • Delegating constructors
  • Arrays of user-defined types

Objects and functions

  • Converting constructors
  • The explicit keyword
  • const member functions
  • Copy elision


  • Static member variables
  • Static member functions

Object-based I/O

  • Nested pointer approaches
  • Pointer-offset approaches
  • Structure overlay approaches

Building complex objects

  • Composition
  • Nested object construction

Connecting objects

  • One-to-one association
  • Bi-directional association
  • friend functions
  • Forward references

Creating Substitutable Objects

  • Specialisation and inheritance
  • Substitution
  • Derived classes
  • Virtual functions

Abstract Base Classes

  • The Single Responsibility Principle
  • Pure virtual functions
  • Extending class interfaces
  • dynamic_cast and its cost

Realising Interfaces

  • The Dependency Inversion Principle
  • Interfaces as design constructs
  • Pure virtual classes
  • Multiple inheritance of Interfaces
  • Cross-casting


  • The interrupt mechanism
  • Encapsulating an interrupt within a class
  • Race conditions

Principles of concurrency

  • Concurrency vs Parallelism
  • Simulating parallelism
  • Scheduling methodologies


  • Creating thread objects
  • Modifying priority and stack size
  • Dealing with time

Mutual exclusion

  • Race conditions
  • Mutexes
  • The Scope-locked Idiom

Thread synchronisation
Condition variables
The Monitor pattern