Real-Time Systems Development with RTEMS and Multicore Processors
eBook - ePub

Real-Time Systems Development with RTEMS and Multicore Processors

  1. 518 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Real-Time Systems Development with RTEMS and Multicore Processors

Book details
Book preview
Table of contents
Citations

About This Book

The proliferation of multicore processors in the embedded market for Internet-of-Things (IoT) and Cyber-Physical Systems (CPS) makes developing real-time embedded applications increasingly difficult. What is the underlying theory that makes multicore real-time possible? How does theory influence application design? When is a real-time operating system (RTOS) useful? What RTOS features do applications need? How does a mature RTOS help manage the complexity of multicore hardware?

Real-Time Systems Development with RTEMS and Multicore Processors answers these questions and more with exemplar Real-Time Executive for Multiprocessor Systems (RTEMS) RTOS to provide concrete advice and examples for constructing useful, feature-rich applications. RTEMS is free, open-source software that supports multi-processor systems for over a dozen CPU architectures and over 150 specific system boards in applications spanning the range of IoT and CPS domains such as satellites, particle accelerators, robots, racing motorcycles, building controls, medical devices, and more.

The focus of this book is on enabling real-time embedded software engineering while providing sufficient theoretical foundations and hardware background to understand the rationale for key decisions in RTOS and application design and implementation. The topics covered in this book include:



  • Cross-compilation for embedded systems development


  • Concurrent programming models used in real-time embedded software


  • Real-time scheduling theory and algorithms used in wide practice


  • Usage and comparison of two application programmer interfaces (APIs) in real-time embedded software: POSIX and the RTEMS Classic APIs


  • Design and implementation in RTEMS of commonly found RTOS features for schedulers, task management, time-keeping, inter-task synchronization, inter-task communication, and networking


  • The challenges introduced by multicore hardware, advances in multicore real-time theory, and software engineering multicore real-time systems with RTEMS

All the authors of this book are experts in the academic field of real-time embedded systems. Two of the authors are primary open-source maintainers of the RTEMS software project.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Real-Time Systems Development with RTEMS and Multicore Processors by Gedare Bloom, Joel Sherrill, Tingting Hu, Ivan Cibrario Bertolotti in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Science General. We have over one million books available in our catalogue for you to explore.

Information

Publisher
CRC Press
Year
2020
ISBN
9781351255776
Edition
1

1
Introduction

Multicore processors are nowadays ubiquitous in desktop computing and are becoming more and more popular in many other application domains, ranging from mobile phones to hard real-time embedded systems. Yet, how to use them effectively with the help of an embedded real-time operating system is still little known to many practitioners. In the open-source arena, the matter is made even more complex due to the lack of comprehensive learning material in the scientific and technical literature. Thus, potential users easily run into the risk of misusing multicore processors, or not considering their merits and pitfalls in the right perspective.
The goal of the book is to provide readers with hands-on knowledge about the design and development cycle of a typical real-time application using the Real-Time Executive for Multiprocessor Systems (RTEMS) operating system, which is a representative and widely used Real-Time Operating System (RTOS) for embedded systems. The narrative starts from basic ideas (for instance, how to use an open-source toolchain) and then proceeds to discuss state-of-the-art concepts (like multicore scheduling and synchronization), which are in part still open to research.
Building on the extensive knowledge of leading RTEMS designers and developers, as well as academic researchers, the book aims at providing not only sound theoretical information but also valuable practical advice with a thorough description of the RTEMS Application Programming Interfaces. The topics covered in the book enable average readers to understand all aspects of the embedded software development process and readily apply the acquired knowledge in their next project. Moreover, fundamental theoretical concepts are introduced along the way, focusing on their consequences on the above-mentioned practical topics, which makes this book also good for graduate-level classroom use.
Part I of the book introduces the reader to embedded software development. First of all, it describes the fundamental tools used to compile and link application software and how the RTEMS operating system is configured for use. Then, the discussion continues with the basics of concurrent programming, real-time scheduling, and scheduling analysis. The chapters in this part are:
  • Chapter 2, Cross-Compilation Toolchain. This chapter first describes the main components of a GNU-based1 cross-compilation toolchain, focusing in particular on the linker command language and on GNU make, a tool commonly used to coordinate and automate the software build process. The second part of the chapter discusses the compile-time configuration of the RTEMS operating system.
  • Chapter 3, Concurrent Programming and Scheduling Algorithms. The first main goal of this chapter is to lay out the theoretical foundations of concurrent programming. The discussion covers the all-important concept of process, or task, and how task state is represented within an operating system as it evolves over time. The second part of the chapter introduces the reader to real-time scheduling methods and techniques on single-processor systems, while the discussion of scheduling algorithms suitable for multicore systems is left to Part V.
  • Chapter 4, Scheduling Analysis and Interrupt Handling. The main topic of this chapter is scheduling analysis, a set of mathematical tools to predict the worst-case timing behavior of a real-time system. The discussion starts from a high-level view of the system, abstracted as a set of tasks, and then shows how interrupt handling fits in the scheduling analysis framework. A set of practical considerations on interrupt handling, using a popular microprocessor architecture as a reference, concludes the chapter and helps illustrate how RTEMS implements some key activities, like context switch.
1 GNU stands for GNU's Not Unix!
Part II discusses the concepts and mechanisms of task management and timekeeping, along with the two Application Programming Interfaces (APIs) that give users access to them. In particular:
  • Chapter 5, Task Management and Timekeeping, Classic API. This chapter is devoted to the RTEMS scheduling algorithms for single-core systems and the facilities that RTEMS provides to manipulate tasks and account for the passage of time through its Classic API. It also contains a comparison with the POSIX standard API and a description of some lower-level aspects of interrupt handling on single-core systems made accessible by the RTEMS Interrupt Manager and often essential in embedded systems.
  • Chapter 6, Task Management and Timekeeping, POSIX API. The chapter contains an extensive description of the POSIX API for task management and timekeeping. Special attention is given to the cancellation and signalling mechanisms, which do not have a direct counterpart in the Classic API.
Part III discusses the all-important topic of lock-based task synchronization and communication, as well as its interaction with scheduling and scheduling analysis. The three chapters in this part also introduce the reader to the main synchronization devices and message passing directives available in RTEMS through its Classic and POSIX APIs.
  • Chapter 7, Inter-Task Synchronization and Communication (IPC) Based on Shared Memory. This chapter describes the fundamental concepts of race condition, critical region, and lock-based mutual exclusion. It introduces the reader to the classic inter-task synchronization and communication methods based on shared memory, namely, semaphores and monitors. Two more specialized synchronization devices, barriers and events, are also included in the discussion due to their considerable practical interest.
  • Chapter 8, IPC, Task Execution, and Scheduling. This chapter is devoted to priority inversion and deadlock, two very important issues related to lock-based synchronization and communication, which may impair the timings of any real-time system if not appropriately solved. To this aim, the chapter discusses several suitable design-time and runtime methods and techniques.
  • Chapter 9, IPC Based on Message Passing. This chapter introduces readers to message passing, an IPC mechanism that does not rely on shared memory for data transfer, thus paving the way to a unified IPC technique that is also suitable for distributed systems in which multiple independent nodes are connected by a communication network. As in the rest of the book, theoretical concepts are presented together with their RTEMS implementation.
Part IV describes how RTEMS provides full-fledged TCP/IP network communication, which is becoming an ubiquitous requirement in modern embedded systems. It is composed of two chapters:
  • Chapter 10, Network Communication in RTEMS. This chapter describes the internal structure of the RTEMS networking code and highlights the most important aspects of operating system / protocol stack integration, such as synchronization and the device driver interface.
  • Chapter 11, POSIX Sockets API. This chapter complements the previous one and discusses in detail how users can access the RTEMS networking code in an operating system and protocol-independent way, by means of the standard POSIX Sockets API.
Part V concludes the book. Its two chapters describe the issues brought by multicore embedded processors and how RTEMS supports them:
  • Chapter 12, Multicores in Embedded Systems. The chapter outlines the motivation behind the widespread diffusion of multicore processors for embedded systems and provides an overview of their architecture. Then, it summarizes the challenges introduced by multicores in software development for embedded systems, focusing on the areas of task scheduling, schedulability algorithms and analysis, and proper inter-task communication and synchronization.
  • Chapter 13, Multicore Concurrency: Issues and Solutions. The chapter summarizes the most common scheduling algorithms and synchronization devices for real-time multicore systems and illustrates how they are supported in RTEMS. The second part of the chapter provides information about lock-free and wait-free synchronization, which is often a valid alternative to lock-based synchronization described in Part III, as well as the use of spinlocks for task/interrupt handler synchronization.

Part I
Operating System Basics

2
Cross-Compilation Toolchain

CONTENTS

2.1 From Source Code to the Executable Image
2.1.1 The Compiler Driver
2.1.2 The Preprocessor
2.1.3 The Linker
2.2 Linker Scripts
2.2.1 Input and Output Sequences
2.2.2 Memory Layout
2.2.3 Linker Symbols
2.2.4 Section and Memory Mapping
2.3 GNU Make and Makefiles
2.3.1 Explicit Rules
2.3.2 Variables
2.3.3 Pattern Rules and Automatic Variables
2.3.4 Directives and Functions
2.4 Basic Description of RTEMS and its Configuration System
2.4.1 RTEMS Compile-Time Configuration
2.4.2 Application Compile-Time Configuration
2.5 Summary
This chapter explains the general compilation approach adopted in embedded systems and then introduces the main components of a GNU-based toolchain. Among them, special attention is given to the linker command language used to write linker scripts and to GNU make, which is one of the most widespread tools for coordinating and automating the software build process. A short discussion of the RTEMS configuration system concludes the chapter.

2.1 FROM SOURCE CODE TO THE EXECUTABLE IMAGE

Unlike general-purpose systems, where code is compiled, built, and executed on the same machine, development for embedded systems usually requires the availability of a cross-compilation toolchain. It compiles and builds the source code on a host machine where the cross-compilation toolchain runs. Instead, the compiled code will execute on a target machine, in this case an embedded device. This is due to the resource limits on embedded devices, for instance, memory capacity and processor speed. Even when embedded boards are shipped with a pre-installed general-purpose operating system such as Linux, which consequently enables support for native compilation, these setups are generally not meant for real-time execution purpose.
Figure 2.1 demonstrates the compilation process, which translates source code into an executable image, using the GCC-based cross-compilation toolchain. As shown in the figure, a cross-compilation toolchain usually consists of the following components:
Flow chart diagram from left to right. Flow originates from six multi-documents on the left. The top two are labeled “C sources” and “C headers” and point by right arrow to a box labeled “Compiler gcc.”  This box connects by a right arrow to a multi-document labeled “Object Files *.o” and by a dashed arrow down to a box labeled “Assembler as.” The Assembler box also connects by right arrow to the Object files, and is connected to by a right arrow from the third multi-document labeled “ASM sources” in the first column. The Object Files multi-document connects by a right arrow to a box labeled “Linker ld” and by a down arrow to a box labeled “Librarian (Archiver) ar.” A multi-document labeled “Linker Scripts” connects by a down arrow to the Linker box. The Librarian box connects by a down arrow to a multi-document labeled “Libraries *.a.” This multi-document connects by a right arrow to the Linker box. The bottom three multi-documents in the first column are labeled “Startup code crt*.o”, “Compiler support *.a”, and “C libraries *.a” all connected by right arrows to the Linker box. The Linker box connects by a right arrow to a multi-document labeled “Exec. File a.out”. A shaded area labeled “GNU make” covers the Compiler, Assembler, Librarian, and Linker boxes.
FIGURE 2.1 Simplified view of the C-language toolchain workflow.
  • The GCC Compiler. It translates a C/C++ source file, which in turn may include other headers or source files, and produces an object module in binary format. This generally involves a multi-step code generation process, which is better detailed in Section 2.1.1. Although it is generally called “the compiler”, the gcc program is actually a compiler driver, able to perform different actions by invoking other toolchain components appropriately, depending on the input file type usually derived from its filename extension. The compiler driver behavior can be customized by means of command-line options. Depending on the target architecture, different options may be provided, to drive the compilation for that specific architecture. For instance, the -march o...

Table of contents

  1. Cover
  2. Half Title
  3. Series Page
  4. Title Page
  5. Copyright Page
  6. Contents
  7. Preface
  8. The Authors
  9. Chapter 1 Introduction
  10. Part I Operating System Basics
  11. Part II Task Management and Timekeeping
  12. Part III Inter-Task Synchronization and Communication
  13. Part IV Network Communication
  14. Part V Multicores in Real-Time Embedded Systems
  15. References
  16. Index