First Technology Transfer

Standard and Advanced Technical Training, Consultancy and Mentoring

Real Time Linux and Xenomai

Duration: 5 Days

Intended Audience and Prerequisites

This course is for experienced C programmers who also have considerable experience of Linux application programming. Some experience of Kernel programming would be useful, however, Kernel internals, Kernel loadable modules and device driver programming key points will be covered. The course is aimed at developers who will be developing real time applications in both the soft and hard real time senses of real time.

Synopsis

The course, which is taught using either the BeagleBone Black or RasperryPi boards, starts by considering the real time capabilities and limitations of standalone Linux kernel based systems. In this section the emphasis will be on understanding pre-emption in the Linux Kernel and the functionality provided by the PREEMPT_RT patch. The second part of the course introduces a co-kernel approach to helping achieve hard real time using Xenomai as used in Xenomai 2.x and Xenomai 3 - Cobalt. The RTOS API emultation for Native Linux approach, as used in Xenomai 3 - Mercury will also be discussed. The course will consider the following

  • An overview of real time from the software and hardware design viewpoints
  • Terminology used when discussing real time - latency, jitter, worst case, safety critical
  • Sources of latency
  • Real-Time Linux considerations
  • RT-PREEMPT patch
  • Xenomai – co-kernel design approach and Adeos/I-pipe
  • POSIX-RT api
  • Linux threads
  • Real-time IPC (Inter Process Communication)
  • AIO - Linux Asyncrhonous IO
  • Real-Time aspects of networking - RTnet and RTmac
  • Overview of distributed real-time processing issues
  • Input/output interfaces and Real Time - Serial, GPIO, SPI, I2C
  • Analog IO
  • Real-Time Linux and Industrial I/O
  • Contents:

    • Linux and Real Time
      • Linux as a general-purpose operating system.
      • Real-Time concepts and terminology - latency, jitter, worst case, safety critical
      • Sources of latency
      • Interrupts and delayed interrupt handling
      • Kernel preemption (voluntary and forced preemption)
      • Uses of High Resolution Timers
      • Techniques for measuring Embedded Linux latency
        • External methods (oscilloscope, logic analyzer)
        • Internal timers, and latency buffer approaches
        • Kernel profiling
        • Tracers (ftrace), function tracing and histograms
        • Generating load and emulating real usage
      • Hard real time vs. soft real time
      • Why hard real time requires a pre-emptible kernel
      • Real time Linux and kernel pre-emption strategies
      • Voluntary kernel pre-emption
      • Increasing opportunities for pre-emption in the Linux Kernel (pre-emptable kernel)
      • PREEMPT-RT patch
      • Micro kernel approaches
    • Multi-tasking and Inter-process Communication
      • Multi Tasking - tasks vs. threads
      • Semaphores
      • Periodic Scheduling
      • Intertask Communication Patterns
      • Priority Scheduling
      • Round Robin Scheduling
      • Priority Inversion
      • Interrupts
      • Measuring Jitter and Latency
    • Hardware Abstraction Layer
      • What is a Hardware Abstraction Layer (HAL)
      • HAL and support for multiple operating systems
      • HAL functionality provided by Adeos
      • Installing Adeos as a Linux Kernel loadable module
      • Configuring Adeos
      • Understanding the Adeos interrupt pipeline
      • How Adeos, Xenomai and Linux can work together
    • Xenomai
      • Installing and Configuring Xenomai 2.6
      • Setting up Linux to work with Xenomai
      • Understanding how Linux and Xenomai work together
      • Instrumenting Xenomai and Linux to collect timing information
      • Xenomai multi-tasking
      • Xenomai semaphores
      • Xenomai periodic scheduling
      • Xenomai intertask communication
      • Linux as a Xenomai task
      • Hardware controlled by Linux vs. hardware controlled by Xenomai
      • Xenomai priority scheduling
      • Xenomai round robin scheduling
      • Xenomai and priority inversion
      • Xenomai interrupts and interaction with the Linux interrupt handling framework
      • Measuring Jitter and Latency
    • Xenomai 3 - An Overview
      • History of Xenomai 3
      • Differences between Xenomai 3 and Xenomai 2.6
      • Building a Xenomai 3 - Cobalt co-kernel system
      • Building a Xenomai 3 - Mercury single kernel architecture system
      • Mercury vs. Cobalt - pros and cons
    • Real-Time communications
      • Real-Time networking
      • Network stack, protocols, sockets, raw sockets
      • RTnet and RTmac
      • Aspects of distributed real-time processing
      • Serial buses - input/output interfaces: Serial, GPIO, SPI, I2C, CAN
      • Industrial protocols CAN and Modbus
      • Analog input
      • Industrial I/O
      • Aspects of Real-Time Linux in Safety-Critical environments
        • Watchdog timers
        • Error recovery - memory ECC, error-safety algorithms.