Advanced C Programming
Many engineers work with the C programming language everyday for real-time embedded development. However, some hit a plateau and never feel comfortable with certain aspects of the language.This course aims to progress individuals and give them a fuller appreciation of the more advanced aspects of the language.
Due to the requirements for programming real-time embedded systems, this course goes beyond just addressing the language issues and explores compile, link and run-time issues. In addition it covers interrupts and multi-tasking areas specific to C.
50% of the course is spent writing code for a real target.
Dates:
Course Outline
Day 1
Introduction Program Structure:
- Importance of good structure
- Quality and style
Pointers, Arrays & Dynamic Allocation:
- Arrays & pointers; compatibility and incompatibility
Function Pointers:
- Basics
- Callbacks
- State machine
Unscrambling Declarations:
- Rules
- Using typedef
Day 2
Enumerations, Structures and Unions:
- Enum vs. #define
- Struct layout
- Uses of union
Interrupts:
- Hardware interrupt models
- Software interrupts
Multi-Tasking (Multi-Threading)
- Terminology
- Advantages and disadvantages
- Intertask Communication & Synchronisation
Day 3
The Linker:
- Memory sections
Start-up, Runtime and the Stack:
- What happens before main
- What is happening at runtime
- Estimation of stack requirements
Dynamic Memory:
- Malloc, calloc and realloc
- Variable sized structures
- Dangers
Memory Management and Protection:
- Memory protection
- MMU
- Segmentation and paging
Day 4
Writing Safer C:
- MISRA-C Guidelines
OOP with C:
- Object-based and object-oriented
- Classes, inheritance and polymorphism
- Associations and aggregation
Number Crunching:
- Floating-point and fixed-point number systems
- IEEE Standard 754
The Standard Library:
- Major issues
C99:
- Summary of significant new features
Course Overview
An intensive four day course covering the advanced aspects of C programming for the real-time embedded programmer.
Course Objectives:
- To become comfortable with the advanced aspects of the C programming language
- To gain an in-depth knowledge on what is happening at compile, link and runtime on a target processor
- To introduce good quality and style for real-time embedded programming
- To gain hands-on experience of programming up interrupts and real-time operating systems (RTOS).
Delegates Will Learn:
- Advanced aspects of the C programming language
- The traps and pitfalls of the language (e.g. structure packing, dynamic memory, etc.)
- Compile, link, and run-time memory models
- MISRA-C (www.misra.org.uk) guidelines
- What parts of C should and should not be used in real-time embedded systems programming
Pre-requisites:
- A good grasp of the fundamentals of C
OR
- Attendance of Feabhas course C-501 : C for Real-Time Programmers.
Who Should Attend:
This course is designed for engineers who want to improve their grounding and understanding of the C programming language. It is specifically aimed at issues relevant to real-time embedded software engineers.
Duration:
- Four days
Course Materials:
- Delegate handbook
Related Courses:
- RTOS-201 Fundamentals of Real-Time Operating Systems
- OO-503 Real-Time Software Design with UML
- MC-101 Guidelines for Writing High Integrity Software in C
- C-501 C for Real-Time Developers
Course Workshop:
The course workshop uses the IAR compiler and the NXP LCP2129 ARM7TDMI microcontroller as a target for the hands-on sessions. Exercises are designed to stretch attendees’ abilities and explore subtleties of the language. A good working knowledge of the C programming language is essential as some of the exercises involve extensive programming.


