System Programming for Embedded Linux

The performance and stability of a system ultimately depends on how well you use the resources of the underlying operating system. This course focuses on the interface between applications and the Linux kernel and the POSIX specification in particular. Attendees will learn about multi-threaded programming, memory management, signals and interprocess communication, including IPC using local sockets. 

It is intended for engineers working on embedded Linux devices, and hence there is an emphasis throughout on robust design, efficient use of resources and real-time behaviour. All lab exercises are cross-compiled and tested on a typical embedded development board.

EL-401
4 days
£1960
, pdf download

Dates:

19 - 22 May 2014
15 - 18 Sep 2014

Course Outline

 

Developing for embedded Linux

  • The tool-chain: choosing, installing and testing
  • The Linux kernel: customising and cross-compiling
  • Application program interfaces: POSIX  and Linux extensions to POSIX

Debugging

  • Debugging a remote target device using gdb and gdberver

Files and devices

  • Files and file-related API: waiting for several things to happen with select() and poll()
  • Devices: everything is a file. Interfacing with a simple device driver. Using the ioctl() function  to access device-specific operations
  • Processes
  • Files and file-related API: waiting for several things to happen with select() and poll()
  • Devices: everything is a file. Interfacing with a simple device driver. Using the ioctl() function  to access device-specific operations

Memory

  • Virtual memory and its consequences
  • Allocating from the heap and stack
  • Mapping memory using mmap

Signals

  • Standard and real-time signals
  • Writing robust signal handlers
  • Signal masks and how to handle signals synchronously

Real-time Linux kernels

  • Files and file-related API: waiting for several things to happen with select() and poll()
  • Devices: everything is a file. Interfacing with a simple device driver. Using the ioctl() function  to access device-specific operations

Inter-process communication

  • Pipes
  • Shared memory and semaphores
  • Messages queues
  • Sockets: internet and UNIX (local).  Stream and datagram connections

POSIX Threads

  • Thread life cycle: pthread_create(), pthread_exit(), pthread_join()
  • Scheduling threads: real-time and non-real-time
  • The thread stack and how to set the stack size

Thread synchronisation

  • Synchronisation using mutexes: priority inversion and priority inheritance
  • Condition variables: producer and consumer threads
  • Thread cancellation and clean-up operators


Time and timers

  • Timer accuracy: high-resolution timers, POSIX clocks and  timers
  • Measuring time
  • Periodic tasks

Course Overview

 

Pre-requisites:

  • A good understanding of the C language
  • familiarity with Linux or Unix command-line
  • Familiarity with development tools such as make and gcc

Who Should Attend:

Software engineers and system architects.

Duration:

Four days.

Course Materials:

Printed copies of the presentations and lab notes plus electronic copies of the cross development tools, sample code and worked solutions for the labs.

Related Courses:

Hands-on Labs:

An essential part of the training are the lab sessions, which take approximately 50% of the time. We normally work in pairs using a modern development board such as the BeagleBone. Each group will also need a laptop or desktop to run the system development tools. We will provide a bootable USB memory stick with an appropriate version of Linux and cross tool-chain so there is no need to install Linux beforehand.