Crafting Embedded Systems in C++

Crafting Embedded Systems in C++ is a two-day training course with programming exercises taught by Ben Saks. It is offered onsite at the Gaylord Rockies from 09:00 to 17:00 on Saturday, October 23rd and and Sunday, October 24th, 2021 (immediately prior to the conference). Lunch is included.

Course Description

This course explains how to use C++ to write safe, efficient, and maintainable embedded programs. Step by step, it shows how to leverage C++ language features to write abstractions for hardware devices in a bare metal environment. It also explains how to make these abstractions easy to use and hard to misuse by turning potential run-time errors into compile-time errors. Although the course focuses primarily on standard features of C++, it also covers a few non-standard features when needed.

Many of the constructs that C++ provides for controlling hardware devices are also features of C. These features include pointers, bitwise operators, enumeration types, and the const and volatile qualifiers. This course demonstrates how C++ supports these features in ways that make them even more useful, especially for embedded developers.

In addition, C++ has a lot more to offer to embedded programmers. For example, classes can provide simpler and safer interfaces that hide the often-messy details of interacting with hardware. Templates and inheritance can promote code reuse by capturing commonality among related hardware and software components. Overloading and user-defined type conversions can support friendlier and safer user interfaces. The constexpr keyword can increase execution speed and reduce code size by turning run-time computations into compile-time computations.

Prerequisites

Participants should have basic knowledge of the C++ language and standard library.

This course includes programming exercises. The exercises run on a simulator provided by the instructor. Each exercise compiles and links with the simulator in C++ and executes as a command-line application. Please bring a computer with a C++11 or C++14 development environment that can build command-line applications.

Course Topics

  • Memory-mapped object placement and initialization
  • Hardware abstraction techniques
  • Co-located devices
  • Standard-layout types
  • Alignment and padding concerns
  • Static assertions to verify layout
  • Placement and class-specific new
  • Using const and volatile appropriately
  • Function and operator overloading
  • inline and constexpr functions
  • Constant expressions and constexpr objects
  • Enumeration types
  • Using implicit conversions to create simpler, more intuitive interfaces

Time permitting, attendees’ choice of either:

  • Advanced techniques for turning run-time errors into compile-time errors, or
  • Interrupt handling, critical sections, and atomic types

Register Here

Course Instructors

Ben SaksBen Saks is the chief engineer of Saks & Associates, which offers training and consulting in C and C++ and their use in developing embedded systems. Ben represents Saks & Associates on the ISO C++ Standards committee as well as two of the committee’s study groups: SG14 (low-latency) and SG20 (education). He has spoken at industry conferences, including the C++ and System Software Summit, the Embedded Systems Conference, NDC Techtown, and CppCon, where he’s also chair of the Embedded Track and a member of the program committee. Ben previously worked as a software engineer for Vorne Industries, where he used C++ and JavaScript to develop embedded systems that help improve manufacturing productivity in factories all over the world. He’s also a contributing author on multiple Vorne patents.