Crafting Embedded Systems in C++ [2023 class archive]

Crafting Embedded Systems in C++ is a three-day online training course with programming exercises taught by Ben Saks. It is offered online from 09:00 to 15:00 Aurora time (MDT), 11:00 to 17:00 EDT,  17:00 to 23:00 CEST, Wednesday, September 27th through Friday, September 29th, 2023 (prior to the conference).

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++17 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 Instructor

Ben Saks Ben 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 has represented 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.