Embedded Software Development: The Open-Source Approach, 1st Edition (Hardback) book cover

Embedded Software Development

The Open-Source Approach, 1st Edition

By Ivan Cibrario Bertolotti, Tingting Hu

CRC Press

526 pages | 99 B/W Illus.

Purchasing Options:$ = USD
Hardback: 9781466593923
pub: 2015-12-22
SAVE ~$29.00
eBook (VitalSource) : 9781315215600
pub: 2017-12-19
from $28.98

FREE Standard Shipping!


Embedded Software Development: The Open-Source Approach delivers a practical introduction to embedded software development, with a focus on open-source components. This programmer-centric book is written in a way that enables even novice practitioners to grasp the development process as a whole.

Incorporating real code fragments and explicit, real-world open-source operating system references (in particular, FreeRTOS) throughout, the text:

  • Defines the role and purpose of embedded systems, describing their internal structure and interfacing with software development tools
  • Examines the inner workings of the GNU compiler collection (GCC)-based software development system or, in other words, toolchain
  • Presents software execution models that can be adopted profitably to model and express concurrency
  • Addresses the basic nomenclature, models, and concepts related to task-based scheduling algorithms
  • Shows how an open-source protocol stack can be integrated in an embedded system and interfaced with other software components
  • Analyzes the main components of the FreeRTOS Application Programming Interface (API), detailing the implementation of key operating system concepts
  • Discusses advanced topics such as formal verification, model checking, runtime checks, memory corruption, security, and dependability

Embedded Software Development: The Open-Source Approach capitalizes on the authors’ extensive research on real-time operating systems and communications used in embedded applications, often carried out in strict cooperation with industry. Thus, the book serves as a springboard for further research.


"… provides a consistent description covering many aspects of embedded systems development and explains their interrelationships, which is a very important complement to other in-depth literature. … As such, this book fills a gap … and will prove valuable to students and professionals who need a single, coherent source of information."

—Kristian Sandström, ABB Corporate Research, Västerås, Sweden, from IEEE Industrial Electronics Magazine, March 2016

"… a brilliant and complete self-empowering guide through the labyrinth of embedded software development while riding the open-source motorbike."

—Wolfgang Betz, Principal Engineer, STMicroelectronics S.R.L., Milan, Italy

"… a solid, grounded, and highly readable introduction to embedded software development where resource management, proper execution model selection, and deterministic behavior matter A LOT. In my field of safety and mission-critical development, the first principles explained in this book are the foundation upon which all other embedded software development depends. This book provides readers with an explanation of embedded software principles built on current and relevant examples."

—Thomas Ferrell, FAA Consulting, Inc., Charlottesville, Virginia, USA

"The book is technically sound and solidly rooted in the significant experience and professional background of the authors, so that readers needing or simply wishing to learn about embedded software development can perfectly rely on its clear and comprehensive coverage. … References constantly made to open-source s/w components and their discussion throughout the book offer precious added value. … The best way to synthesize the authors’ work with only one term: balance of theory and practice, informality and rigor of presentation, concepts and implementation, conciseness and clarity."

—Adriano Valenzano, IEIIT-CNR, National Research Council of Italy, Torino

Table of Contents



Embedded Applications and Their Requirements

Role and Purpose of Embedded Systems

Microcontrollers and Their Internal Structure

General-Purpose Processors versus Microcontrollers

Embedded Software Development Process


GCC-Based Software Development Tools


Compiler Driver Workflow

C Preprocessor Workflow

The Linker

The C Runtime Library

Configuring and Building Open-Source Software

Build Process Management: GNU Make


Execution Models for Embedded Systems

The Cyclic Executive

Major and Minor Cycles

Task Splitting and Secondary Schedules

Task-Based Scheduling

Task State Diagram

Race Conditions in Task-Based Scheduling


Concurrent Programming Techniques

Task Management

Time and Delays


Message Passing


Scheduling Algorithms and Analysis

Scheduling Algorithms for Real-Time Execution

Scheduling Analysis


Configuration and Usage of Open-Source Protocol Stacks

Introduction to the LwIP Protocol Stack

Operating System Adaptation Layer

Configuration Options

Netconn Interface

Network Buffer Management

POSIX Networking Interface


Device Driver Development

General Structure of a Device Driver

Interrupt Handling

Device Driver Interfaces

Synchronization Issues

Example: Ethernet Device Driver


Portable Software

Portability in Embedded Software Development

Portability Issues in C-Language Development

Application Programming Interfaces

GCC Extensions to the C Language


The FreeRTOS Porting Layer

General Information

Basic Data Types

Time Representation and Architectural Details

Context Switch

Interrupt Handling and Critical Regions

Task Stack Initialization

Tick Timer

Architecture-Dependent Scheduler Startup


Performance and Footprint at the Toolchain Level

Overview of the GCC Workflow and Optimizations

Optimization-Related Compiler Options

Architecture-Dependent Compiler Options

Source-Level Optimization: A Case Study


Example: A Modbus TCP Device

Toolchain and Operating System

General Firmware Structure

Modbus Slave Protocol Stack

USB-Based Filesystem

Application Code

Performance and Footprint



Model Checking of Distributed and Concurrent Systems


The SPIN Model Checker

The Promela Modeling Language

Property Specification

Performance Hints


Model Checking: An Example


Distributed Master Election Protocol

Formal Promela Protocol Model

Formal Verification Results


Memory Protection Techniques

Memory Management Units (MMUS)

Memory Protection Units (MPUS)

MPUS versus MMUS

Memory Checksumming

CRC Calculation

Data Structure Marking

Stack Management and Overflow Detection


Security and Dependability Aspects

Introduction to Splint

Basic Checks

Memory Management

Buffer Overflows

Function Interface Annotations



About the Authors

Ivan Cibrario Bertolotti received the Laurea degree (summa cum laude) in computer science from the University of Torino, Turin, Italy, in 1996. Since then, he has been a researcher with the National Research Council of Italy (CNR). Currently, he is with the CNR’s Institute of Electronics, Computer, and Telecommunication Engineering (IEIIT), Turin, Italy. His research interests include real-time operating system design and implementation, industrial communication systems and protocols, and formal methods for vulnerability and dependability analysis of distributed systems. His contributions in this area comprise both theoretical work and practical applications, carried out in cooperation with leading Italian and international companies. He taught several courses on real-time operating systems at Politecnico di Torino, Turin, Italy, from 2003 until 2013, as well as a PhD degree course at the University of Padova in 2009. He regularly serves as a technical referee for the main international conferences and journals on industrial informatics, factory automation, and communication. He has been an IEEE member since 2006.

Tingting Hu holds a master’s degree in computer engineering and a PhD degree in computer and control engineering, both from Politecnico di Torino, Turin, Italy. Since 2010, she has been a research fellow with the National Research Council of Italy (CNR). Currently, she is with the CNR’s Institute of Electronics, Computer, and Telecommunication Engineering (IEIIT), Turin, Italy. Her main research interests are the design and implementation of real-time operating systems and communication protocols, focusing on deterministic and flexible execution and communication for distributed real-time embedded systems. A significant amount of her research activities are carried out in strict collaboration with industry. She is actively involved in several regional and national industrial research projects in the context of the Italian "Factory of the Future" framework program. Moreover, in 2014 she taught a postgraduate-level course about real-time operating systems and open-source software for embedded applications aimed at company technical managers. She has been an IEEE member since 2011 and serves as technical referee for several primary conferences in her research area.

About the Series

Embedded Systems

Learn more…

Subject Categories

BISAC Subject Codes/Headings:
COMPUTERS / Software Development & Engineering / General
COMPUTERS / Computer Engineering
TECHNOLOGY & ENGINEERING / Electronics / General