Using C++ in Embedded Systems – Applying C++11/14/17/20
Place: TBD
DKK 15.500
EUR 2.000
Request more information
Heidi Lehtomäki – Finland
phone: +358 40 196 0142
heidi.lehtomaki@nohau.fi
Lena Bernhardsson – Sweden
+46 (0) 40 59 22 09
lena.bernhardsson@nohau.se
Klaus Ahrensbach – Denmark
Phone: +45 3116 1019
ka@nohau.dk
Training material and lunch are included (Lunch is not included for Online Courses)
Overview:
Over the years, the object-orientated programming turned out to be a sound and battle-hardened way of working in system development. Traditionally C has been the dominating programming language in the embedded system context. This training intends to introduce C++ as the common extension of C when applying object-oriented embedded system development. Since C++ encloses C, this training takes us from C to C++ in a natural way and looks under the hood of how C++ is implemented. This is especially valuable to comprehend when applying C++ in an embedded resource limited environment. The recent years the C++ standard has been undergoing a few revisions – a.k.a. as C++11, C++14, C++17, C++20 – and a new one is on its way, C++23. This course addresses subjects brought in with these revisions that are especially useful like high performance memory management, concurrency making use of a multicore environment, and bare-metal close to the hardware programming.
Goal/Benefits:
The major objective of this class is that you shall be able to use C++ in a “correct way”.
♦ Introduce C++ as an object-oriented language alternative in an embedded system context
♦ Show the similarities – and differences – with the C language
♦ Comprehend different memory management strategies – especially the move semantics introduced with C++11
♦ Look under the hood and understand what different paradigms in C++ leads to in machine code
♦ Discuss about using constexpr to get things done already at compile-time –the replacement for macros and hardcoded literals
♦ To use templates to achieve type safe high order abstractions for bare-metal close to the hardware programming – memory mapped I/O as well as interrupts – especially the variadic templates introduced with C++11
♦ Provide some useful design patterns especially applicable in an embedded context
♦ A few exercises to practice some concepts
Audience/Participants
This training is aimed C++- programmers who intend to start using C++ in an embedded system context.
Previous Knowledge
The course requires basic knowledge in C++ programming, corresponding to our trainings
”C++ Level 1 – An Odyssey of C++: Core Language” and
”C++ Level 2 – An Odyssey of C++: Standard Library”.
Practical Exercises
During the training you will practice the presented concepts in a few exercises. We will use the open and free integrated development environment from Eclipse.
Outline:
1. What’s an Embedded System?
- Simple Definition
- Some Milestones
- Characteristics
- Why using C++?
2. Comparison with C
- C: A subset of C++ – almost
- Performance
- Added “Free” Functionality
- Why not using C++?
3. Classes
- Member Variables
- Instance variables
- Class variables
- Member Functions
- Instance functions
- Class functions
- Implicit Methods
- Constructor
- Initialization
- Uniform Initialization with Initializer Lists
- Delegation
- Destructor
- Copy assignment operator
- Constructor
- Rvalue references and Move Semantics – avoiding unnecessary deep copy
struct
in C++- Package/Namespace
4. Inheritance
- Realization
- Performance
- Multiple Inheritance
- Virtual Inheritance
5. Polymorphism
- Virtual Function
- Virtual Destructor
- Implementation
- Runtime Type Information, RTTI
- Performance
6. Templates
- Function Template
- Class Template
- Variadic Templates
- Code Bloat
- Implementation Strategies
- Template versus Inheritance?
7. Error Handling
- Exception Handling
- Performance Issues
- Implementation
8. Inline Code
- When to Use?
- Strategies
9. Start-up
- System Start-up
- The C Part
- The C++ Part
10. Standard Library
- Standard Template Library, STL
iostream
Library- STL Major Extensions due to Modern C++:
- Rvalue References – Move semantics
- Variadic Templates
- Concurrency
11. Memory Management
- The C++ Memory Model
- Standardized Word Widths – The
stdint-
types - Strongly Typed Enumerations
- Atomic Types and their Operations
- Standardized Word Widths – The
constexpr
std::byte
- Standard Library Allocator API
- Strategies
- Variables
- Placement new
- User Defined Memory Management
12. Interoperation between C and C++
- Name Mangling
- Static Initialization
- Dynamic Memory
struct
Contents- POD – Plain Old Data type
13. Design Patterns
- RAII – Resource Acquisition Is Initialization
- Memory-mapped I/O
- Interrupt
- Initialization of Static Objects