Embedded C++ Basics Training

Contents „Embedded C++ Basics Training“

This embedded C++ training teaches the C++ 17 basics for programming embedded applications.

Embedded programs are often characterized by special requirements. They often have a special program structure (setup, loop), no heap may be used to avoid memory fragmentation, they must react to interrupts, comply with requirements such as the MISRA or AUTOSAR guidelines, etc.

Traditionally, embedded programs are often written in C. With the advancement of compilers, most language elements of C++ today no longer have any disadvantage over C in terms of code size and speed.

  • The new C++ standards (C++11, C++14, C++17, C++20 and C++23) have added new language elements to C++ that result in faster and smaller code than the C alternatives.
  • However, one of the most important arguments in favor of C++ is that embedded programs are becoming more complex and larger. This complexity is often difficult to handle with the C features. Here, C++ offers enormous advantages that save development costs and contribute to the reliability of applications.
  • Essentially all compilers for embedded programs (Espressif, STM32CubeIDE, Arduino usw.) support the new C++ standards..

Seminar Objectives: In this Embedded C++ basic course, fundamental language elements and concepts of C++ (e.g. data types, statements, object-oriented programming) are introduced. The focus is on the new language features of C++11C++14 and C++17 and their possible applications for embedded systems. Numerous examples show their possible use for common microcontroller boards (STM32ESP32ArduinoRasperry Pi etc.). Together with the language elements, the AUTOSAR C++14 and  MISRA rules for safety-related systems are also presented.

The contents can be adapted to the wishes of the participants.

1. Elementary Data Types and Instructions

  • Integral types (int, bool, char, etc.)
  • Floating point types
  • Standard conversions
  • Type safe initializations and conversions with initializer lists
  • Elementary statements (if, for, while, etc.)
  • Functions
  • Constants with const and constexpr
  • Preprocessor instructions (macros, pragmas)
  • Expressions
  • Arrays
  • typedef
  • Namespaces

2. Functions, Value- and Reference Parameters

  • Value and reference parameters
  • Function pointers, Interrupts and Interrupt Service Routines (ISR)
  • Recursion
  • Inline functions
  • Default arguments
  • Overloaded functions and operators
  • Functions of the standard library (e.g. math.h and cmath)
  • The „function type“ std::function

3. The string classes string, wstring etc.

  • Member functions for string manipulation
  • Raw string literals
  • Unicode strings
  • Conversions between strings and elementary data types
  • Regular expressions

4. Simple self-defined data types

  • Classes defined with struct
  • Weak and strongly typed enumeration types (enum)
  • Finite state machines
  • Task scheduling

5. Pointers

  • Pointer variables and the address operator
  • Dynamically created variables, new and delete
  • Dynamic Arrays
  • Arrays, pointer arithmetic
  • Function pointers
  • Linked lists and tree structures
  • Zero terminated strings and associated library functions

6. Object-oriented programming

  • Classes, data members and member functions
  • The rule of zero
  • Data encapsulation: private, public and protected
  • The this pointer
  • Constructors and destructors
  • OO Analysis and Design
  • Standard constructor, copy constructor, and assignment operator
  • Static class members
  • Inheritance and multiple inheritance
  • Implicit conversions between classes in a hierarchy
  • is-a and has-a relationships – inheritance vs. composition
  • Virtual functions, override and polymorphism

7. Container classes

  • vector, list, deque etc.
  • Iterators
  • The range-based for loop
  • Algorithms of the Standard Library

About „Embedded C++ Basics Training“

Target audience for this C++ training

Software developers who want to learn C++ for professional use, in particular experienced embedded C programmers who want to move to C++.

Teaching style of the C++ seminar

Lecture with many examples. A balanced combination of theory and practice.

  • At the beginning of a new topic, an overview of applications, basic ideas and syntax is given.
  • The concepts and the syntax are illustrated by using carefully selected and proven examples. Often, best practices“ are presented.
  • The manuscript contains numerous practical exercises.
  • If desired, tasks from the work of the students can also be dealt with. This should be arranged before the start of the training.

Training Materials

Extensive and detailed training materials (approx. 200 pages) – Full text, no PowerPoint slides containing only keywords. Therefore, the course materials can also be used as a reference at work.

Place and time of this C++ training

This seminar is offered as an inhouse seminar (at your site). The implementation as a face-to-face seminar is preferred, but is also possible as an online seminar. Dates by arrangement.

Duration: 5 days

Lecturer

Prof. Richard Kaiser has been conducting seminars for companies for many years, mainly on software development and the programming languages C#, C++ and C. He knows the requirements of practice and addresses them in detail, both in the basic concepts and in the details. His clients include renowned global corporations and small and medium-sized enterprises. He is the author of several books on C++, most recently „C++ mit Visual Studio 2019“. He was a member of the DIN standardization committee Information Technology NI-22 for many years.

Contact Prof. Richard Kaiser