Thursday 17 October 2019

Developing & Delivering KnowHow

Home > Training > FreeRTOS Real-Time Programming

F2F trainingFreeRTOS Real-Time Programming

Standard Level - 3 days

view dates and locations

Real-Time Operating Systems (RTOSes) are operating systems developed for embedded microprocessors or controllers. These systems have the ability to immediately respond in a predetermined and predictable way to external events, so they must meet strict deadline constraints and handle different aspects of the application successfully.

A key feature of an RTOS is ensuring that most urgent operations are taken care of by assigning higher priorities. Real-Time systems also focus on the communication and synchronization between different tasks to achieve the objective of the application.

FreeRTOSThis course is based on FreeRTOS, the de facto and freely available standard RTOS for microcontrollers. Attendees will gain the knowledge and skills needed to develop and maintain applications running in a Real-Time environment.

Workshops comprise approximately 50% of class time, and are based around carefully designed Labs to reinforce and challenge the extent of learning.

The course is provided in partnership with embedded experts AC6.

What you will learn

  • Cortex-M4 architecture overview
  • Discover the concepts of Real-Time multitasking
  • Understand Real-Time constraints
    • Determinism
    • Preemption
    • Interrupts
  • Understand the FreeRTOS architecture
  • Discover the various FreeRTOS services and APIs
  • Learn how to develop FreeRTOS applications

Who should attend?

This course is designed for anyone interested in, or tasked with, the development of a resource constrained Real-Time system. For example - software engineers, field engineers and (project) managers.



  • An ST STM32F4 (Cortex/M4) with System Workbench IDE

Course materials

  • Printed course materials are provided to each delegate.

This course is provided in partnership with embedded experts AC6.

Structure and Content


Cortex-M resources used by RTOS

  • Cortex-M Architecture Overview
    • Two stacks pointers
    • Different Running-modes and Privileged Levels
    • MPU Overview
    • Systick Timer Description
  • Exception / Interrupt Mechanism Overview
    • Interrut entry and return Overview
    • SVC / PendSV / Systick Interrupt Presentation
  • Developing with the IDE

Lab: Interrupt Management on Cortex-M4

Element of a Real-Time system

  • Base Real-Time concepts
  • The Real-Time constraints
  • Multi-Task and Real-Time
  • Tasks and Task Descriptors
    • Content of the task descriptor
    • List of task descriptors
  • Context Switch
  • Task Scheduling and Preemption
    • Tick based or tickless scheduling
  • Scheduling systems and schedulability proof
    • Fixed priorities scheduling
    • RMA and EDF scheduling
  • Scheduling through FreeRTOS
    • Deterministic preemptive scheduling
    • Scheduling strategies
    • Cooperative scheduling
    • Hybrid scheduling

Lab: Analyse a Context Switch


Task Management

  • The Task life-cycle
    • Creating tasks
    • Deleting tasks
    • The Endless-loop pattern
  • Task Priorities
    • Assigning task priorities
    • Changing task priorities
  • The idle task
    • Idle task hooks
  • Timing

Lab: Managing tasks

Resource Management

  • Mutual exclusion through FreeRTOS
    • Critical sections (interrupt masking)
    • Suspending (locking) the scheduler
    • Mutexes
  • Mutexes concepts
    • Mutex or Semaphore
    • Recursive or not recursive mutexes
    • Priority inversion problem
    • Priority inheritance (the automatic answer)
    • Priority ceiling (the design centric answer)
  • Gatekeeper tasks

Lab: Implement mutual exclusion between tasks

Synchronization Primitives

  • Introduction
    • Waiting and waking up tasks
    • Semaphores
    • Events
    • Mailboxes
  • Binary Semaphores through FreeRTOS
    • Give a Binary Semaphore
    • Take a binary Semaphore
  • Queue Management through FreeRTOS
    • Creation
    • Sending on a queue
    • Receiving from a queue
    • Data management
    • Sending compound types
    • Transferring large data
  • Event groups

Lab: Synchronizing a task with another one through binary semaphores
Lab: Synchronizing a task with another one through queues


Parallelism Problems Solution

  • Parallel programming problems
    • Uncontrolled parallel access
    • Deadlocks
    • Livelocks
    • Starvation

Lab: The producer-consumer problem, illustrating (and avoiding) concurrent access problems
Lab: The philosopher’s dinner problem, illustrating (and avoiding) deadlock, livelock and starvation

Interrupt Management

  • Need for interrupts in a Real-Time system
    • Software Interrupt
    • Time Interrupts
    • Device Interrupts
  • Level or Edge interrupts
  • Hardware and Software acknowledge
  • Interrupt vectoring
  • Interrupts and scheduling
  • Deferred interrupt processing through FreeRTOS
    • Tasks with interrupt synchronization
    • Using semaphores within an ISR
    • Counting semaphores
    • Using queues within an ISR
  • FreeRTOS interrupt processing
    • Writing ISRs in C
    • Interrupt safe functions
    • Interrupt nesting

Lab: Synchronize Interrupts with tasks

Software Timer

  • The Timer Daemon Task
  • Timer Configuration
  • One-shot / Auto-reload Timer
  • Software Timer API
  • Deferred interrupt handling

Lab: Implement Soft Timers


  • The Cortex/M MPU
    • User and privileged modes
    • Access permissions
  • Defining MPU regions
    • Overlapping regions
    • Predefined regions
    • Programmer-defined regions
  • Needed linker configuration
  • Practical usage tips

Lab: Implement protected memory regions

Data structures

  • Need for specific data structures
  • Data structures
    • Linked lists
    • Circular lists
    • FIFOs
    • Stacks
  • Data structures integrity proofs
    • Assertions
    • Pre and post-conditions
  • Thread safety

Lab: Build a general purpose linked list

Memory Management

  • Memory management algorithms
    • Buddy System
    • Best fit / First Fit
    • Pools Management
  • FreeRTOS-provided memory allocation schemes
    • Allocate-only scheme
    • Best-fit without coalescing
    • Thread-safe default malloc
  • Checking remaining free memory
  • Adding an application-specific memory allocator
  • Memory management errors
  • Stack monitoring

Lab: Write a simple, thread safe, buddy system memory manager
Lab: Write a generic, multi-level, memory manager
Lab: Enhance the memory manager for memory error detection

Trouble Shooting

  • Checking for stack problems
  • Common pitfalls

Course Dates:
November 12th, 2019 Ankara, TR Enquire
December 16th, 2019 Ringwood, UK Enquire
April 7th, 2020 Munich, DE Enquire
April 15th, 2020 Ankara, TR Enquire
May 26th, 2020 Ringwood, UK 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
Privacy Policy Site Map Contact Us