First Technology Transfer

Standard and Advanced Technical Training, Consultancy and Mentoring

ELIN 102 Systems and Network Programming for Embedded Linux

Duration: 5 Days

Intended Audience

Attendees are expected to have a good knowledge of Linux/Unix and C programming, and should have some experience of working with embedded systems.

Synopsis

The course focuses on the system call API provided by the linux kernel to application software; that is, on the Linux "virtual machine" as defined by the POSIX standard (IEEE 1003.1). The course covers all major system programming features of Linux, from basic I/O operations to interprocess and network communications, to the exploitation of concurrency through the use of threads and processes. Programs will be developed to run on PCs running Linux as well as on ARM based boards such as the BeagleBone Black or RaspberryPi. The emphasis will be on learning how to write well structured and efficient code that makes effective use of the POSIX API. The standard idioms and patterns for creating and managing multiple processes and threads, and the various inter-process communication mechanisms provided by the POSIX API for synchronising processes and threads will be explored in detail. The course will also cover the implementation of TCP/IP applications - both client and server side -- using the sockets API.

Course Outline

  • Getting Started
    • Receiving command line arguments
    • Accessing environment variables
    • Reading and writing stdin and stdout
    • How to detect and handle system call errors
  • Multiprocessing
    • The memory model and life cycle of a process
    • Creating processes with fork
    • Executing programs with exec
    • Waiting for process termination
    • Returning and retrieving exit status
  • Multithreading
    • The memory model and life cycle of a thread
    • Creating threads with the pthreads API
    • Waiting for thread termination
    • How are threads and processes different?
    • Synchronising access to shared data
    • When to use multiple processes and threads
  • Basic I/O
    • Low-level input and output
    • Reading and writing files
    • Changing file attributes
    • Managing files and directories
  • Interprocess Communication
    • Pipes
    • Message queues
    • Shared memory
    • Semaphores
  • Signals
    • What are signals for?
    • Sending signals
    • Ignoring and catching signals
    • Writing signal handlers
  • Working with the Linux Security Model
    • Changing file permissions and ownerships
    • Accessing the user account database
    • Setting the user identity of a process
  • Network Communication (IPv4)
    • TCP/IP fundamentals
    • Client/server programming
    • Connection-oriented sockets
    • Connectionless sockets
    • Name resolution
  • Overview of IPv6 and network programming with IPv6
  • The Linux development environment
    • The traditional build model
    • Header files
    • Automating rebuilds with make
    • Writing platform-independent code with GNU configure
    • Using Eclipse as an integrated C development enviromnent
    • Debugging with gdb
    • Overview of Autoconf and Automake
    • Overview of Version Control using Git or Subversion (SVN)
    • Overview of Cross Compilers and Cross Compilation Tool Chains
  • Linux special file systems
    • Overview of the /dev and the underlying Linux device driver model
    • Working with /dev devices
    • Working with /dev devices and IOCTL
    • Overview of the /proc filesystem
    • Using the /proc filesystem in embedded applications
    • Overview of the /sys filesystem
    • Using the /sys filesystem in embedded applications