Barr Group TwitterBarr Group Vimeo

Course Overview

Course Length: 
4 Days
CEUs: 
3.0
Format: 
Hands-on/Lecture

 Download the Complete Course Syllabus

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++ increases readability and aids in the prevention and handling of run-time errors with minimal impact on code 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 it also employs non-standard approaches as needed.

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 moving from C to C++
  • C++ programmers seeking to enhance their hardware interfacing skills

Prerequisites: You should arrive with experience programming in C. Prior experience with C++ is not necessary. The course covers the non-C parts of C++ as needed to explain the examples and exercises in the course. 

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

 

 

Syllabus

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

Introduction

  • 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

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
  • const and Class Design
  • const Member Functions
  • Symbolic Constants

Classes and Objects

  • Storage Layout for Class Objects
  • Implementing Member Function Calls
  • C++ Classes vs. C Structures

Device Register Addressing

  • Representing Memory-Mapped Registers
  • "Placing" Memory-Mapped Objects
  • Overly-Aggressive Optimization
  • Semantics of volatile
  • The Right Does of Volatility
  • Overloading for a Better Interfacing
  • 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

Advanced Interrupt Dispatch Techniques

  • Virtual Function Interrupt Dispatcher
  • Template-based Interrupt Dispatcher

Modern C++ Features

  • Type Traits
  • Enumeration Base Types and Scope
  • Generalized Constant Expressions
  • User-Defined Literals
  • auto as a Type Specifier
  • range-for Statements

Related Courses

Upcoming Sessions

Date(s) Location PRICE Register
Oct 9 to Oct 12
Embedded Systems Programming in C++
Germantown, Maryland, United States $2,199.00 *
Inquire

Find out More

To find out more about our upcoming public trainings, go to our Training Calendar.

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

Recording Policy

All Barr Group Training Public and On-site courses may not be audiotaped, videotaped or photographed without consent from Barr Group's executive team.  Barr Group reserves the right to record portions or all of a training course for instructional purposes.  As a result, attendees present may also appear on the recording.