Course Overview

Course Length: 
4 Days

This course will teach you how to use C++ to write efficient and maintainable embedded programs. You'll learn how to leverage C++'s classes and templates to write readable, yet efficient, abstractions to represent and manipulate peripheral hardware in a bare metal environment.

C++ has a lot to offer to embedded programmers. Classes can be very helpful in hiding the messy details of interacting with hardware behind clean APIs. Templates and inheritance can help you capture commonality and promote reuse. Overloading and user-defined type conversions can support friendlier and safer user interfaces. Modern C++ offers additional tools to increase readability, prevent run-time errors, and improve execution time.

This course emphasizes programming styles and idioms that turn potential run-time errors into compile-time errors. It takes you “under the hood” to see how compilers and linkers implement C++ language features, giving you the insight you need to avoid many performance pitfalls. It focuses primarily on coding techniques that use standard features of the C++ programming language, but of necessity it also occasionally employs non-standard approaches.

Programming exercises designed to reinforce the lessons presented are included.

Topics covered during this course include:

  • Enumeration and Class Types
  • The const and volatile Qualifiers
  • Nested Constants and Types
  • Function and Operator Overloading
  • Inheritance
  • Templates
  • Language Linkage
  • Hardware Interfacing
  • Interrupt Handling
  • Error Handling

This course is appropriate for:

  • Embedded software developers interested in leveraging the features of C++
  • C++ programmers seeking to enhance their hardware interfacing skills

Prerequisites: You should arrive with experience programming in C. You need not have much experience programming in C++, but you should be familiar with the following core features of C++: the “C” part of C++, classes, constructors and destructors, and function name and operator overloading. You should also have some exposure to the const qualifier, namespaces, new- and delete-expressions, reference types, single inheritance, static class members, virtual functions, and templates. 

Prior experience writing hardware interfaces is helpful, but not necessary.

For on-site training, a 3-day version of this course is also available for audiences with experience in C++ development.



Explore this course:

Find out more:


The following is a summary of the major course topics and are not the section-by-subsection lecture breakdown.


  • Course Overview
  • Expectations

Fundamental Concepts

  • Obsolete and Deprecated Features
  • Erroneous and Non-Portable Behaviors
  • Translation Units and Object Modules
  • Declarations and Definitions
  • Arguments and Parameters
  • Scope vs. Linkage vs. Storage Duration
  • Lvalues and Rvalues

Data Types

  • Static Checking
  • size_t and Extended Integer Types
  • New-Style Casts

The const and volatile Qualifiers

  • CV-Qualifiers: const and volatile
  • The Structure of Declarations
  • Writing T const vs. const T
  • const as a Promise
  • Qualification Conversions
  • Symbolic Constants
  • Overly-Aggressive Optimization
  • Semantics of volatile

Classes and Objects

  • Storage Layout for Class Objects
  • Implementing Member Function Calls
  • C++ Classes vs. C Structures
  • Const Member Functions
  • Static Members
  • Inlining
  • Public Inheritance
  • Member Initializers

Device Register Addressing

  • Representing Memory-Mapped Registers
  • “Placing” Memory-Mapped Objects
  • The Right Dose of Volatility
  • Overloading for a Better Interface
  • Rethinking the ++ Operator
  • Enumeration Ranges
  • Improving Type-Safety
  • Referencing Memory-Mapped Objects
  • Constructors and New-Expressions
  • Capturing Device Commonality in a Base Class
  • Private Inheritance
  • Using-Declarations and Access-Declarations

Templates in Brief

  • Function Templates
  • Template Type Arguments and Parameters
  • Template Argument Deduction
  • Class Templates
  • Template Non-Type Arguments and Parameters

Build-Time Error Detection

  • Write-Only Class Templates
  • Const vs. Read-Only
  • Read-Only Class Templates
  • Disallowing Copy Operations
  • Preventing Dynamic Allocation

Interrupt Handling

  • Polling vs. Interrupts
  • Interrupt Numbers, Vectors, and Vector Tables
  • Interrupt Service Routines
  • Linking C++ with C and Assembly
  • Name Mangling and Language Linking
  • Encapsulating Shared Data
  • Race Conditions
  • Critical Sections
  • Atomic Data Types
  • A Policy-Based Design

Modern C++ Features

  • Type Traits
  • Enumeration Base Types and Scope
  • Constexpr Functions and Objects
  • User-Defined Literals
  • auto as a Type Specifier
  • Non-member begin and end
  • Range-For Statements

Related Courses

Find out More

Contact us now to find out more about this course or to enquire about an on-site training at your company.

Recording Policy

Barr Group's courses may not be audiotaped, videotaped, or photographed without consent from Barr Group's executive team.