C++ for Embedded Systems
Who should attend?
Software developers with C experience who want to develop object oriented applications in C++ for embedded systems.
Pre-requisites:
A good working knowledge of C.
Duration:
5 days ( including practical exercises )
Course Description:
This course introduces the programming language C++ for use in embedded systems, as well as the fundamentals of the object oriented way of programming. It has been designed for experienced C programmers, who do not only want to learn the syntax of a new programming language, but also want to understand how object-oriented programming works and what the advandages are over traditional C programming. Assessments of the language features with respect to memory consumption and execution time detail the benefits and the pitfalls of the object oriented approach, thus allowing the students to develop powerful solutions using the scarce resources of embedded systems efficiently. In addition, the course shows how classes and their relationships are represented using the Unified Modelling Language (UML) and thus creates an important basis for good object-oriented software design. Finally, the course also covers how hardware devices can be integrated and used in an object-oriented way. For classroom trainings, the associated exercises are conducted on an ARM-based target hardware, while for online courses, they are carried out using a corresponding software emulator. The language characteristics of this basic course are essentially based on the language standard C++98/03. The characteristics of the newer language standards (C++11, C++14, C++17, C++20) are covered in the advanced course "Modern C++"
Course Outline:
Non-Object-Oriented Language Features and I/O
- Data type bool
- References
- Function overloading
- Default parameters
- Namespaces
- Dynamic memory management
- Operator overloading
- Input/output (cin/cout)
- Cast operators
- Range-base for-loop (C++11)
- Scoped Enumerations (C++11)
- nullptr (C++11)
- Alias type definition with using (C++11)
From Struct to Class
- Data elements, attributes
- Member functions, methods
- Static / non-static elements
- this-Pointer
- Access rights public and private
- Class
Constructors and Destructors
- Default constructor and copy constructor
- Global / static objects and arrays
- Objects containing objects
Operators as Class Members
- Assignment operator
- Subscript operator
- Type cast operator
Inheritance and Aggregation
- Base class and derived class
- Benefits of inheritance compared to aggregation
- Modelling the base class functionality
- Impact on construction and destruction
- Access right protected
- Protected and private inheritance
- Cast operators
Virtual Functions and Polymorphism
- Static and dynamic linking
- Virtual functions
- Abstract functions and abstract classes
- Interfaces
- Cast operators
Assessment of the Language Features
- Object model
- Object creation and deletion
- Temporary Objects
- Inheritance
- Virtual functions
- Dynamic memory management
Object-Oriented Access to Hardware devices
- Traditional solutions
- Struct-based solution
- Hardware device as a C++ object
- Interrupt handling