Embedded Programming with C++
Public sessions now scheduled. See the training calendar for details.
C++ offers the same low-level language facilities as C, including bitfields, bitwise operators, and casts. Therefore, you can use C++ to write device drivers that are every bit as efficient as they would be in C. However, such low-level code is often hard to write and maintain, and it’s rarely portable. Using higher level features of C++, you can implement low-level device drivers that are much easier to read and maintain. Moreover, if you exploit C++ really well, you can write drivers that are almost, if not just, as efficient as they would be in C.
This seminar illustrates techniques involving classes, nested constants and types, user-defined conversions, the const and volatile type qualifiers, and overloading. It also provides a look under the hood to see how compilers and linkers implement C++ language features, giving you the insight you need to avoid many performance pitfalls.
Length/Options
- 2 days (lecture only)
Audience
- Programmers with prior embedded software experience using C
- Embedded software developers seeking to enhance their C++ skills
- Embedded software developers moving (or considering a move) from C to C++
Prerequisites
- Working familiarity with the C programming language
- Prior exposure to basic C++ constructs such as classes, member functions, access control, constructors, destructors, and references
Related Courses
Outline
- Introduction
- What You’re Expected to Know
- Standard Terminology
- Tools of the Trade
- Real Hardware
- Alternative Tool Chains
- Pragmatic Programming Concerns
- Dreaded “Code Bloat”
- EC++: the “Embedded C++” Dialect
- Programming in “EC++ plus Templates”
- Adapting to Different Compilers
- Minimizing Library Usage
- The Const and Volatile Qualifiers
- Placing Const and Volatile in Declarations
- Writing Const T vs. T Const
- Understanding Const and Volatile as Promises
- Qualification Conversions
- Const and Volatile Member Functions
- Programming a Segmented Display
- Accessing Device Registers from C
- Lighting a Segmented Display
- Inadvertent Inefficiencies from Volatile Data
- Using Enumerations
- Overloading for a Better Interface
- A Segmented Character Class Type
- A Better Model of Device Registers
- Programming Other Devices
- Lighting Individual LEDs
- Capturing Commonality in a Base Class
- Pushing a Button
- Filtered and Unfiltered Button Classes
- Reading Slide Switches
- Using a Timer to Keep Time
- Read-only and Write-only Registers
- Chatting with a Serial Port
- Interrupt Handling
- Direct and Indirect Interrupt Service Routines
- “C” Linkage and Interfacing C++ with the Assembly Code
- Installing Interrupt Service Routines
- A Timer Interrupt Handler
- Race Conditions and Mutual Exclusion
- Atomic Access and Atomic Types
- Interrupt-Driven Pushbuttons and Serial Ports
- More Disciplined Approaches
- A More General Interrupt Dispatcher Using Polymorphism
Learn More
To request pricing or dates, or for more information about this course, contact us.
