Advanced C

Overview

Advanced aspects of the C programming language will be taught. Candidates will gain in-depth knowledge of what is happening at compile, link and runtime on a target processor. Candidates are introducing good quality and style for real-time embedded programming. Candidates will also gain hands-on experience of programming up interrupts and real-time operating systems (RTOS).

Duration

4 Days

Pre-Requisites

A good hold of the fundamentals of C

Course Outline

Program objects

  • Declarations and definitions
  • Expressions
  • Scope and lifetime

 The build process

  • compilation, linking, memory sections, libraries

 System startup & runtime

  • What happens before main
  • What is happening at runtime

 Pointers

 Function calling

    • Parameter passing mechanism
    • Pass-by-value vs Pass-by-reference
    • Returning data objects

Hardware manipulation

  • Register access
  • The volatile keyword

 Arrays

  • Initialisation
  • Relationship to pointers

 State machine basics

  • Mealy & Moore machines

Function Pointers

    • Callbacks
    • State machine

Dynamic Memory

  • Malloc, calloc and realloc
  • Variable sized structures
  • Dangers

 Structures, Unions and Bitfields

  • Definition & use
  • Memory layout

 Numerical issues

    • MISRA essential types
    • Floating point issues
    • Fixed point types

Interrupts

  • Hardware interrupt models
  • Software interrupts

 Multi-Tasking (Multi-threading)

    • Terminology
    • Advantages and disadvantages
    • Mutual exclusion
    • Intertask communication & synchronisation