
Introduction to ARM Cortex-M C++ Programming
Duration: 5 Days
Course Background
Duration: 5 Days
Intended Audience
The course is aimed at embedded systems programmers who have a good working knowledge of embedded C programming, but who are about to embark on a new project which will makes extensive use of C++. Some knowledge of Object Oriented analysis and design techniques would be useful, however, any necessary concepts will be introduced during the course.
Course Overview
This 5 day course is aimed at embedded systems developers embarking on their first ARM Cortex embedded C++ project. The course will use the latest version of the IAR C++ compiler for the ARM Cortex family. As well as covering the essential aspects of C++ programming the course will cover the foundations of UML analysis and design as it applies to embedded systems application developers, and the design and implementation of classes that will provide the essential interfaces to the various on chip peripherals such as UARTs, AtoD, I2C, SPI, Timers and GPIO.
Course Benefits and Objectives
The course aims to
- Provide a sound understanding of the C++ programming language
- Instil confidence by demonstrating the essential techniques for applying C++ to embedded and real time system application development
- Teach how to tie in UML analysis and design concepts with the corresponding C++ class specification and implementation
The core topics covered will include
- The syntax and semantics of core C++
- Designing and implementing classes that provide clean APIs for accessing and controlling the hardware
- Techniques for coding interrrupt handlers in C++
- The various aspects of memory management in C++
- Understanding of how C++ can be used to realise state machine driven and multi-tasking designs
At the end of the course student will know
- How to code, compile and test C++ code on the ARM Cortex processor family
- How to use C++ for writing code that will interface with a variety of peripherals found on the ARM Cortex
- Have a good understanding of how object oriented development is to be approached
- Have sufficient understanding of UML so as to be able to make sense of UML diagrams as well as being able to use UML notation to describe various aspects of the design of a project to others
- Be aware of the strengths and limitations of C++, and how C++ code is compiled for embedded platforms.
- Have a good understanding of how device driver modules are to be implemented in C++
Course Contents
- Origins of C++ as a set of object-oriented extensions to C
- Basic I/O in C++ using IOStreams
- Object-Oriented Analysis and Design
- Modularisation - Abstraction, High Cohesion, Low Coupling
- An object as an instance of a class
- A messaging metaphor for object interaction
- Complexity Modeling and Hierarchies
- Objects and Classes
- Objects as instances of a class
- A class as something that combines data and methods - member variables and member functions
- Visibility and Access
- Private, public and protected methods and functions
- Static member variables and static member functions
- UML Class Diagrams and Instance Diagrams
- Function overloading
- Operator overloading
- Global operators vs. class member operatorsInline functions
- Defining member functions in a class definition
- Defining member functions in separate .cpp files
- Constructors and destructors
- Memory mapped hardware access
- Object-oriented approaches to hardware abstraction
- Initialiser lists
- Relations - direction and arity - and their representation in UML
- Relations as classes and objects
- Composition vs. aggregation and its representation in UML
- Collections of objects
- Relations - direction and arity - and their representation in UML
- Representing Relations in Class diagrams and Instance diagrams
- Representing inheritance in a class diagram
- Accessing base class members from a derived class
- Public, private and protected inheritance
- Inheritance and pointers to class instances
- Overriding and hiding methods
- Virtual functions, dynamic polymorphism and how this is implemented
- Dynamic binding vs. run time binding
- Pure virtual classes and interfaces
- Run time type identification and safe down-casting
- Template functions
- Template classes
- Introduction to the standard template library
- Sequence containers - vectors, deques and lists
- Associative containers - sets and multisets, maps and multimaps
- Iterators and algorithms
- Interaction diagrams
- Sequence diagrams
- Object-oriented approaches to multi-tasking and task scheduling
- Object-oriented approaches to inter-process communication
- A simple introduction - the Arduino approach to devices and interfaces
- Serial devices and protocols - RS232, I2C and SPI
- Modeling I2C and SPI sensors and devices
- Timers - real timers and virtual timers
- Timeouts and timer collections
- GPIO
- AtoD
- Strategies and issues in building a C++ Framework atop a C based RTOS
- OO-approaches to semaphores and mutexes
- Complex synchronisation using monitors
- Producer-consumer interaction patterns captured in C++
- Finite State Machine and Hierarchical Finite State machine approaches to event-driven and multi-tasking application design