An embedded system interacts with its environment. Many embedded systems actively control some aspect of their environment, such as adjusting the heater in your house during winter, or adjusting ailerons in an aircraft while the aircraft is flying.
Many embedded systems also measure some aspect of their environment. This is the case in a measurement system, for example a temperature measurement system indicating the temperature of a room in your house. In an embedded system performing a control task, the measurements are used also as support for decisions to be taken, such as the decision to increase heat water flow in order to increase the room temperature, or the decision to move an ailerion in a certain direction, for the purpose of keeping an aircraft on its desired course. These decisions are referred to as control actions. The control actions are determined by combining the measurements, in these cases the measured room temperature or the measured heading of an aircraft, with desired values for the measured quantities. The combination is typically done inside an algorithm. The algorithm calculates the exact amount of control action to use. In this way, an embedded system can be said to be reactive, since its actions are based on stimuli, in the form of measurements, from its external environment.
Inside embedded systems, there is software. The software executes on the embedded computers, in systems such as aircrafts, phones, television sets, and cars. The software may be large, in the sense that it has many lines of code. The actual amount of code may vary from a few thousand lines in a small embedded system, to several million lines of code, which is the case for a mobile phone of today.
The software in an embedded system is often thought of as having layers. There may be an upper layer, containing applications, one or more middle layers, perhaps referred to as middleware or services, and there may be lower layers, such as the operating system. Inside, or besides, the operating system, there may be software that manages devices, such as peripherals outside the processor, for example a serial port or hardware for USB communication. Software that manages devices is referred to as device drivers.
This book focuses on the software that sits closest to the hardware. This includes software that may be used in an operating system, and software that may be used in device drivers. It is not a book on how to write an operating system or how to write device drivers. Instead it is a book that explains principles and patterns that are useful when creating such software.
The main purpose of the book is to help the reader understand how this software, which we will refer to as embedded software, can be written and how it depends on the properties of the underlying hardware.