C++ Programming for Embedded Systems
Standard Level - 5 daysview dates and locations
C++ has been a popular general purpose programming language for many years. Recent developments in microcontroller technology (such as ARM Cortex-M), increasing application complexity and enhancements made in the C++ 2011 standard mean that C++ is now replacing C as the preferred language for many embedded systems.
This course teaches the C++ programming language in the context of real-time and embedded systems. It highlights the resource and performance implications of using key C++ features and programming styles. As well as giving delegates an in-depth understanding of the C++ programming language, this course provides practical experience of programming a modern embedded microcontroller using real-time development tools. It is a direct replacement for a general class in C++ programming, with the added benefit that the syllabus, contextual examples and exercises are tuned to the requirements of the Embedded System and System-on-Chip communities.
Although C++ for Embedded Systems focuses on the C++ language features that are appropriate for "bare metal" systems or those using a Real-Time Operating System (RTOS), the course is also suitable for anyone wishing to learn C++ to develop applications within an Embedded Linux environment – C++ features such as stream-based I/O that are generally only used with complex operating systems are included in an optional module that can be presented if there is sufficient time and interest.
The workshops are based around carefully designed exercises programming and debugging a real embedded system to reinforce and challenge the extent of learning, and comprise approximately 50% of class time.
Who should attend?C++ for Embedded Systems is aimed at electronic hardware, software and system-on-chip engineers who need to gain a working knowledge of the C++ language to build an embedded system. The course is also suitable as a general introduction to C++ programming, particularly for anyone working in an electronics-related business area or with a background in digital electronics.
What will you learn?
- The syntax and semantics of the C++ language (including C++11)
- The principles of object-oriented modelling, embedded software programming and real-time programming
- How to program an embedded microcontroller in C++
- A practical introduction to real-time development tools
- How to debug a C++ program on a target device
- How to access memory-mapped peripherals using C++
- How to write interrupt handlers in C++
- An introduction to real-time operating systems and scheduling
- Best practices for embedded programming
Pre-requisitesDelegates should have had some exposure to the C programming language, in particular a basic level of familiarity with functions, variables, data types, operators, and statements. A good working knowledge of another high-level programming language is an acceptable alternative. No previous knowledge of C++ or Embedded Systems is required. This course is not suitable as a first course in computer programming.
Please contact Doulos direct to discuss and assess your specific experience against the Pre-requisites.
Course materialsDoulos Course materials are renowned for being the most comprehensive and user friendly available. Their style, content and coverage is unique in the HDL training world, and has made them sought after resources in their own right. Fees include:
- Fully indexed course notes creating a complete reference manual
- Workbook full of practical examples and solutions to help you apply your knowledge
Structure and Content
Day 1 - Learn about the differences between C and C++
Requirements for C++ in an Embedded SystemEmbedded system characteristics • Language choice • Memory mapped peripherals • Volatile variables • Compilation • System boot-up • Best Practices
Summary of CA refresher on basic C syntax • Functions • Control flow • Fundamental types • Literals • Derived types • Operators • Standard libraries
From C to C++ and C++11The features added to C by C++ and the ANSI C-1999 standard • inline • const • Enhanced enumerations • constant expressions • auto • Overview of I/O streams • Function prototypes • Pass-by-reference • Default arguments • Function and operator overloading • String class
Linkage and StorageLearn some tricky features often overlooked in C, but necessary for C++ • Scope • Linkage • Linking C and C++ • Namespaces • Static, automatic and dynamic storage • new and delete • Placement new • Arrays and Pointers • Vectors
C++ Development Environments for Embedded SystemsCompiler Optimization • Object files •Linkers and linker files • Loader • Makefiles • Integrated development environments • Debuggers • In-circuit emulation • Debug with Simulator/Emulator
Day 2 - An introduction to object-oriented programming
Classes and ObjectsIntroduction to modeling and abstraction • Information hiding • Abstract data types • Classes and objects • Public and private class members • Member functions • Scope resolution • this pointer
ConstructorsHow to ensure that objects are properly initialised, and how to tidy up afterwards • Constructors • Destructors • Delegating constructors • Copy constructors • Pointers and objects • Move semantics
Members and FriendsMore features of C++ classes • Friends • Operator overloading • Overloading assignment • Move assignment • Memory fragmentation • Working with memory pools • Static members • Constant
objects and members
Day 3 - Master the subtleties of object-oriented programming in C++
Object-Oriented Modelling and The UMLLearn the principles of object-oriented design • Class relationships • The Unified Modeling Language • Class and object diagrams • Association • Composition • Dependency • Implementing class relationships in C++ • Initialization of class members • Singleton class • Design Patterns
InheritanceDerived classes • Inheritance • Protected members • Casting pointers • Order of initialization
Virtual FunctionsInheriting common behavior • Overriding methods • Virtual functions • Polymorphism • Late binding • Virtual destructors • Vtable • Cost of virtual functions • Abstract base classes and pure virtual functions • Interface classes
Day 4 - Learn to make use of some standard libraries and to develop your own class templates
Further C++ FeaturesUser-defined conversions • Explicit functions • Defaulted and deleted behavior • Run-Time Type Identification • Type casts • Nested classes • Multiple Inheritance • Pointer-to-member •Function
TemplatesFunction templates • Class templates • Template arguments • Template specialization • Dependent name and type lookup • Avoiding code bloat
Standard LibrariesSummary of the standard C and C++ libraries • Container classes • Container adapters • Creating and accessing containers • Initializer lists • Custom allocators • std::array • Other C++11 Enhancements • Iterators • range-for loop
Day 5 - Understand Safety and Multi-tasking Issues
Defensive ProgrammingCoding standards • Code analysis • Compile-time assertions • Run-time errors • Throwing and catching exceptions • Handlers • Standard exception classes • Preventing memory leakage •
unique_ptr • Exception specification • Exceptions in Embedded Systems
Principles of Real-time Operating SystemsConcurrency • Tasks and task switching • FreeRTOS • Creating and running tasks • Synchronisation • Process scheduling and pre-emption • Priority inversion • Mutex, Semaphore and Queue • Use of semaphores with interrupts • RTOS services
Standard Library AlgorithmsPredicates • Function Objects • Bind • Lambda Functions • Filling a container • Non-modifying operations • transform • Searching • Sorting • Summary of the standard algorithms
C++ State Machines (Optional Topic)State machine representations • Single class state machine • State Design Pattern • Boost mpl example
Strings and Streams (Optional Topic)Another look at string class • I/O stream hierarchy • Formatted and unformatted streams • I/O of user-defined types • Manipulators • File Streams • Buffering • Stringstreams
|January 14th, 2019||Ankara, TR||Enquire|
|February 4th, 2019||Munich, DE||Enquire|
|February 11th, 2019||Ringwood, UK||Enquire|
|February 11th, 2019||Chicago, IL||Enquire|
|March 11th, 2019||San Diego, CA||Enquire|
|March 18th, 2019||Ankara, TR||Enquire|
|March 25th, 2019||San Jose, CA||Enquire|
|April 1st, 2019||Boston, MA||Enquire|
|April 8th, 2019||Oslo, NO||Enquire|
|May 6th, 2019||Stockholm, SE||Enquire|
|May 13th, 2019||Munich, DE||Enquire|
|May 20th, 2019||Copenhagen, DK||Enquire|
|June 10th, 2019||Ringwood, UK||Enquire|
|June 24th, 2019||Ankara, TR||Enquire|
|July 8th, 2019||Woodland Hills, CA||Enquire|
|July 29th, 2019||Austin, TX||Enquire|
|August 5th, 2019||Columbia, MD||Enquire|
|indicates CONFIRMED TO RUN courses.|
Looking for team-based training, or other locations?
Complete an on-line form and a Doulos representative will get back to you »
Price on request
Back to top