EMBEDDED AND REAL-TIME
OPERATING SYSTEMS
Course Code: 70439
Mr N Srikanth Prasad
Assistant Professor
Department of Electronics and Communication Engineering
Malla Reddy Engineering College(A)
nsp.mrec@gmail.com
+91-93 9104 9134
1
Prerequisites
• Computer Programming
• Digital Electronics
• Microprocessors and Microcontrollers
2
Learning Objectives
To understand a typical embedded system and its constituents
To learn the selection process of processor and memory for the
embedded systems
To learn communication buses and protocols used in the
embedded and real-time systems
To understand real-time operating system (RTOS) and the
types of RTOS
To learn various approaches to real-time scheduling
To learn software development process and tools for RTOS
applications
3
Course Outcomes
On completion of the course, students will be able to –
CO1:Recognize and classify embedded and real-time systems
CO2:Explain communication bus protocols used for embedded
and real-time systems
CO3:Classify and exemplify scheduling algorithms
CO4:Apply software development process to a given RTOS
application
CO5:Design a given RTOS based application
CO6:Ability to use commercial tools to develop RTOS based
applications
4
Course Description
• Module – I : Introduction to Embedded Systems
• Module - II : Typical Embedded System
• Module - III : Embedded Firmware
• Module – IV : Operating System Concepts
• Module – V : Real-Time Operating Systems
5
TEXT BOOKS:
T1: Introduction to Embedded Systems - Shibu K.V, McGraw Hill.
T2: Qing Li, Elsevier, “Real Time Concepts for Embedded
Systems”, 2011.
REFERENCE BOOKS:
R1: Rajkamal, “Embedded Systems, Architecture,Programming
and Design”, TMH, 2007.
R2: Richard Stevens,“Advanced UNIX Programming”.
6
Module - I: Introduction to Embedded Systems
• Definition of Embedded System
• Embedded Systems Vs General Computing Systems
• History of Embedded Systems
• Classification
• Major Application Areas
• Purpose of Embedded Systems
• Characteristics and Quality Attributes of Embedded Systems.
7
What is an Embedded System?
An embedded system is an electronic/electro-mechanical system designed to perform a specific
function and a combination of both hardware and firmware (software).
Every embedded system is unique and the hardware as well as the firmware is highly specialized to
the application domain.
Embedded systems are becoming an inevitable part of any product or equipment in all fields
including household appliances, telecommunications, medical equipment, industrial control,
consumer products, etc.
8
Embedded Systems vs General Computing Systems
Criteria General Purpose Computing System Embedded System
Contents A system which is a combination A system which is a combination of special
of a generic hardware and a General purpose hardware and embedded OS for
Purpose Operating System for executing executing a specific set of applications.
a variety of applications.
OS It contains a general purpose operating It may or contain an operating system for
system (GPOS). not functioning.
Alterations Applications are alterable The firmware of the embedded system
(programmable) by the user. (It is is pre-programmed and it is non-alterable by
possible for the end user to re-install the the end-user.
OS and also add or remove user
applications.)
Key factor Performance is the key deciding factor in Application specific requirements (like
the selection of the system. Faster is performance, power requirements, memory
better. usage, etc.) are key deciding factors.
Power More Less
Consumption
Response Time Not critical Critical for some applications
Execution Need not be deterministic Deterministic for certain types of ES like
‘Hard Real Time’ systems.
9
Classification of Embedded System
The classification of embedded system is based on following
criteria’s:
On Generation
On Complexity & Performance
On Deterministic Behaviour
On Triggering
10
Based On Generation
First generation(1G):
Built around 8bit microprocessor & microcontroller.
Simple in hardware circuit & firmware developed.
Examples: Digital telephone keypads.
Second generation(2G):
Built around 16-bit µp & 8-bit µc.
They are more complex & powerful than 1G µp & µc.
Examples: SCADA systems
Third generation(3G):
Built around 32-bit µp & 16-bit µc.
Concepts like Digital Signal Processors(DSPs), Application Specific Integrated
Circuits(ASICs) evolved.
Examples: Robotics, Media, etc.
11
Fourth generation:
Built around 64-bit µp & 32-bit µc.
The concept of System on Chips (SoC), Multicore Processors evolved.
Highly complex & very powerful.
Examples: Smart Phones.
12
Based on Complexity & Performance
Small-scale:
Simple in application need
Performance not time-critical.
Built around low performance & low cost 8 or 16 bit µp/µc.
Example: an electronic toy
Medium-scale:
Slightly complex in hardware & firmware requirement.
Built around medium performance & low cost 16 or 32 bit µp/µc.
Usually contain operating system.
Examples: Industrial machines.
Large-scale:
Highly complex hardware & firmware.
Built around 32 or 64 bit RISC µp/µc or PLDs or Multicore Processors.
Response is time-critical. Examples: Mission critical applications. 13
Based on Deterministic Behaviour
This classification is applicable for “Real Time” systems.
The task execution behaviour for an embedded system may
be deterministic or non-deterministic.
Based on execution behaviour Real Time embedded
systems are divided into Hard and Soft.
14
Based on Triggering
Embedded systems which are “Reactive” in nature can be
based on triggering.
Reactive systems can be:
Event triggered
Time triggered
15
Major Application Areas of ES
The application areas and the products in the embedded domain are countless. A
few of the important domains and products are listed below:
I. Consumer electronics: Camcorders, cameras, etc.
II. Household appliances: Television, DVD players, washing machine, fridge,
microwave oven, etc.
III. Home automation and security systems: Air conditioners, sprinklers,
intruder detection alarms, closed circuit television cameras, fire alarms, etc.
IV. Automotive industry: Anti-lock breaking systems (ABS), engine
control, ignition systems, automatic navigation systems, etc.
V. Telecom: Cellulartelephones, telephone switches, handset multimedia
applications, etc.
16
Major Application Areas of ES (Cont’d)
VI. Computer peripherals: Printers, scanners, fax machines, etc.
VII.Computer Networking systems: Network routers, switches,
hubs, firewalls, etc.
VIII.Healthcare: Different kinds of scanners, EEG, ECG machines
etc.
IX. Measurement & Instrumentation: Digital multi meters,
digital CROs, logic analyzers PLC systems, etc.
X. Banking & Retail: Automatic Teller Machines (ATM) and
currency counters, point of sales (POS).
XI. Card Readers: Barcode, smart card readers, hand held
devices, etc.
17
Design Methodologies
• A procedure for designing a system.
• Understanding your methodology helps you
ensure you didn’t skip anything.
• Compilers, software engineering tools,
computer-aided design (CAD) tools, etc., can
be used to:
– help automate methodology steps;
– keep track of the methodology itself.
18
Design Goals
• Performance.
– Overall speed, deadlines.
• Functionality and user interface.
• Manufacturing cost.
• Power consumption.
• Other requirements (physical size, etc.)
19
Levels of Abstraction
requirements
specification
architecture
component
design
system
integration
20
Top-Down vs. Bottom-Up
• Top-down design:
– start from most abstract description;
– work to most detailed.
• Bottom-up design:
– work from small components to big system.
• Real design uses both techniques.
21
Stepwise Refinement
• At each level of abstraction, we must:
– analyze the design to determine characteristics of
the current state of the design;
– refine the design to add detail.
22
Requirements
• Plain language description of what the user
wants and expects to get.
• May be developed in several ways:
– talking directly to customers;
– talking to marketing representatives;
– providing prototypes to users for comment.
23
Functional vs. Non-Functional Requirements
• Functional requirements:
– output as a function of input.
• Non-functional requirements:
– time required to compute output;
– size, weight, etc.;
– power consumption;
– reliability;
– etc.
24
Our Requirements Form
name
purpose
inputs
outputs
functions
performance
manufacturing cost
power
physical size/weight
25
Example: GPS moving map Requirements
• Moving map
obtains position I-78
from GPS, paints
Scotch Road
map from local
database.
lat: 40 13 lon: 32 19
26
GPS Moving MAP needs
• Functionality: For automotive use. Show major
roads and landmarks.
• User interface: At least 400 x 600 pixel screen.
Three buttons max. Pop-up menu.
• Performance: Map should scroll smoothly. No
more than 1 sec power-up. Lock onto GPS within
15 seconds.
• Cost: $120 street price = approx. $30 cost of
goods sold.
27
GPS moving map needs, cont’d.
• Physical size/weight: Should fit in hand.
• Power consumption: Should run for 8 hours
on four AA batteries.
28
GPS moving map requirements form
name GPS moving map
purpose consumer-grade
moving map for driving
inputs power button, two
control buttons
outputs back-lit LCD 400 X 600
functions 5-receiver GPS; three
resolutions; displays
current lat/lon
performance updates screen within
0.25 sec of movement
manufacturing cost $100 cost-of-goods-
sold
power 100 mW
physical size/weight no more than 2: X 6:,
12 oz.
29
Specification
• A more precise description of the system:
– should not imply a particular architecture;
– provides input to the architecture design process.
• May include functional and non-functional
elements.
• May be executable or may be in mathematical
form for proofs.
30
GPS specification
• Should include:
– What is received from GPS;
– map data;
– user interface;
– operations required to satisfy user requests;
– background operations needed to keep the system
running.
31
Architecture design
• What major components go satisfying the
specification?
• Hardware components:
– CPUs, peripherals, etc.
• Software components:
– major programs and their operations.
• Must take into account functional and non-
functional specifications.
32
GPS moving map block diagram
GPS search display
renderer
receiver engine
user
database interface
33
GPS moving map hardware architecture
display frame CPU
buffer
GPS
receiver
memory
panel I/O
34
GPS moving map software architecture
position database pixels
renderer
search
user
timer
interface
35
Designing hardware and software
components
• Must spend time architecting the system
before you start coding.
• Some components are ready-made, some can
be modified from existing designs, others
must be designed from scratch.
36
System Integration
• Put together the components.
– Many bugs appear only at this stage.
• Have a plan for integrating components to
uncover bugs quickly, test as much
functionality as early as possible.
37
Purpose of Embedded Systems
Embedded systems are used in various domains like consumer electronics,
home automation, telecommunications, automotive industry, healthcare, control &
instrumentation, retail and banking applications, etc. Within the domain itself,
according to the application usage context, they may have different functionalities.
Each embedded system is designed to serve the purpose of any one or a
combination of the following tasks:
Data collection/Storage/Representation
Data Communication
Data (signal) processing
Monitoring
Control
Application specific user interface
38
Data Collection/Storage/Representation
Embedded systems designed for the purpose of data collection
performs acquisition of data from the external world.
Data collection is usually done for storage, analysis, manipulation and
transmission.
The term “data” refers all kinds of information, such as text, voice,
image, video, electrical signals and any other measurable quantities.
Data can be either analog (continuous) or digital (discrete).
Embedded systems with analog data capturing techniques collect
data directly in the form of analog signal whereas embedded
systems with digital data collection mechanism converts the analog
signal to the digital signal using analog to digital (A/D) converters
and then collects the binary equivalent of the analog data.
39
Data Collection/Storage/Representation (Cont’d)
If the data is digital, it can be directly captured without any additional
interface by digital embedded systems.
The collected data may be stored directly in the system or may be
transmitted to some other systems or it may be processed by the
system or it may be deleted instantly after giving a meaningful
representation.
These actions are purely dependent on the purpose for which the
embedded system is designed.
Embedded system designed for pure measurement applications
without storage, used in control and instrumentation domain,
collects data and gives a meaningful representation of the collected
data by means of graphical representation or quantity value and
deletes the collected data when new arrives at the data collection
terminal. 40
Data Collection/Storage/Representation (Cont’d)
Analog and digital CROs without storage memory are typical examples
of this. Any measuring equipment used in the medical domain for
monitoring without storage functionality also comes under this
category.
A digital camera is a typical example of an embedded system with data
collection/storage/representation of data. Images are captured and the
captured image may be stored within the memory of the camera.
The captured image can also be presented to the user through a graphic
LCD unit.
41
Data Communication
Embedded data communication systems are deployed in applications from
complex satellite communication systems to simple home networking
systems.
The data collected by an embedded terminal may require transferring of the
same to some other system located remotely.
The transmission is achieved either by a wire-line medium or by a wire-less
medium.
Wire-line medium was the most common choice in all olden days embedded
systems.
As technology is changing, wireless medium is becoming the standard
for data communication in embedded systems. It offers cheaper connectivity
solutions and make the communication link free from the hassle of wire
bundles.
42
Data Communication (Cont’d)
The data collecting embedded terminal itself can incorporate data
communication units like Wireless modules (Bluetooth, ZigBee, Wi-Fi,
EDGE, GPRS, etc.) or wire-line modules (RS-232C, USB, TCP/IP, PS2,etc).
Certain embedded systems act as a dedicated transmission unit between
the sending and receiving terminals, offering sophisticated functionalities like
data pa?cketizing, encrypting and decrypting.
Network hubs, routers, switches, etc. are typical examples of dedicated
data transmission embedded systems.
They act as mediators in data communication and provide various features like
data security, monitoring etc.
43
Data (Signal) Processing
The data (voice, image, video, electrical signals and other measurable
quantities) collected by embedded systems may be used for various kinds of
data processing.
Embedded systems with signal processing functionalities are employed in
applications demanding signal
processing like speech coding, synthesis, audio video codec, transmission
applications, etc.
A digital hearing aid is a typical example of an embedded system employing
data processing. Digital hearing aid improves the hearing capacity of hearing
impaired persons.
44
Monitoring
Almost all embedded products coming under the medical domain are with
monitoring functions only.
They are used for determining the state of some variables using input
sensors. They cannot impose control over variables.
A very good example is the electro cardiogram (ECG) machine for monitoring
the heartbeat of a patient. The machine is intended to do the monitoring of the
heartbeat of a patient but it cannot impose control over the heartbeat. The sensors
used in ECG are the different electrodes connected to the patient’s body.
Other examples with monitoring function are measuring instruments like digital
CRO, digital multimeters, logic analyzers., etc. used in control &
instrumentation applications. They are used for knowing (monitoring) the
status of some variables like current, voltage, etc. They cannot control the
variables in turn.
45
Control
Embedded systems with control functionalities impose control over some
variables according to the changes in input variables.
A system with control functionality contains both sensors and actuators.
Sensors are connected to the input port for capturing the changes in
environmental variable or measuring variable.
The actuators connected to the output port are controlled according to the
changes in the input variable to
• put an impact on the controlling variable to bring the controlled variable to the
specified range.
Air conditioner system used in our home to control the room temperature
to a specified limit is a typical example for embedded system for control
purpose. An air conditioner contains a room temperature sensing element
(sensor) which may be thermistor and a handheld unit for setting up
(feeding) the desired temperature.
46
Control (Cont’d)
The handheld unit may be connected to the central embedded unit
residing inside the air conditioner through a wireless link or through a
wired link.
The air compressor unit acts as the actuator. The compressor is
controlled according to the current room temperature and the desired
temperature set by the end user.
The input variable is the current room temperature and the controlled
variable is also the room temperature. The controlling variable is cool
air flow by the compressor unit.
If the controlled variable and input variable are not at the same
value, the controlling variable tries to equalize them through taking
actions on the cool air flow.
47
Applications specific user interface
Buttons, switches, keypad, lights, speakers, display units, etc. are
application-specific user interfaces.
Mobile phone is an example of application specific user interface. In
mobile phone, the user interface is provided through the keypad,
graphic LCD module, system speaker, vibration alert, etc.
48
Characteristics and Quality Attributes of
Embedded Systems
• CHARACTERISTICS OF EMBEDDED SYSTEM
Following are some of the characteristics of an embedded system
that make it different from a general purpose computer:
1. Application and Domain Specific
2. Reactive and Real Time
3. Operation in Harsh Environment
4. Distributed
5. Small Size and Weight
6. Power Concerns
49
Application and Domain Specific
An embedded system is designed for a specific
purpose only. It will not do any other task.
Ex. A washing machine can only wash, it cannot cook
Certain embedded systems are specific to a domain:
ex. A hearing aid is an application that belongs to the
domain of signal processing
50
Reactive and Real Time
Certain Embedded systems are designed to react to the
events that occur in the nearby environment. These events
also occur real-time.
Ex. An air conditioner adjusts its mechanical parts as soon
as it gets a signal from its sensors to increase or decrease the
temperature when the user operates it using a remote
control.
An embedded system uses Sensors to take inputs and has
actuators to bring out the required functionality.
51
Operation in Harsh Environment
Certain embedded systems are designed to operate in
harsh environments like very high temperature of the
deserts or very low temperature of the mountains or
extreme rains.
These embedded systems have to be capable of
sustaining the environmental conditions it is designed
to operate in.
52
Distributed
Certain embedded systems are part of a larger system and
thus form components of a distributed system.
These components are independent of each other but have
to work together for the larger system to function properly.
Ex. A car has many embedded systems controlled to its
dash board. Each one is an independent embedded system
yet the entire car can be said to function properly only if all
the systems work together.
53
Small Size and Weight
An embedded system that is compact in size and has
light weight will be desirable or more popular than one
that is bulky and heavy.
Ex. Currently available cell phones. The cell phones
that have the maximum features are popular but also
their size and weight is an important characteristic.
For convenience users prefer mobile phones than
phablets. (phone + tablet pc)
54
Power Concerns
It is desirable that the power utilization and heat
dissipation of any embedded system be low.
If more heat is dissipated then additional units like heat
sinks or cooling fans need to be added to the circuit.
If more power is required then a battery of higher power
or more batteries need to be accommodated in the
embedded system.
55
Characteristics and Quality Attributes of
Embedded Systems
• QUALITY ATTRIBUTES OF EMBEDDED
SYSTEMS
These are the attributes that together form the
deciding factor about the quality of an embedded
system.
There are two types of quality attributes are:
1. Operational Quality Attributes.
2. Non-Operational Quality Attributes.
56
Operational Quality Attributes
These are attributes related to operation or functioning
of an embedded system. The way an embedded system
operates affects its overall quality.
1. Response
2. Throughput
3. Reliability
4. Maintainability
5. Security
6. Safety
57
Response
Response is a measure of quickness of the system.
It gives you an idea about how fast your system is
tracking the input variables.
Most of the embedded system demand fast response
which should be real-time.
58
Throughput
Throughput deals with the efficiency of system.
It can be defined as rate of production or process of a
defined process over a stated period of time.
In case of card reader like the ones used in buses,
throughput means how much transaction the reader can
perform in a minute or hour or day.
59
Reliability
Reliability is a measure of how much percentage you rely upon
the proper functioning of the system .
Mean Time between failures and Mean Time To Repair are terms
used in defining system reliability.
Mean Time between failures can be defined as the average time
the system is functioning before a failure occurs.
Mean time to repair can be defined as the average time the
system has spent in repairs.
60
Maintainability
Maintainability deals with support and maintenance to the end user or a client in
case of technical issues and product failures or on the basis of a routine system
checkup
It can be classified into two types :
1. Scheduled or Periodic Maintenance
This is the maintenance that is required regularly after a periodic time interval.
Example :
Periodic Cleaning of Air Conditioners
Refilling of printer cartridges.
2. Maintenance to unexpected failure
This involves the maintenance due to a sudden breakdown in the functioning of
the system.
Example:
Air conditioner not powering on
Printer not taking paper in spite of a full paper stack 61
Security
Confidentiality, Integrity and Availability are three corner
stones of information security.
Confidentiality deals with protection data from unauthorized
disclosure.
Integrity gives protection from unauthorized modification.
Availability gives protection from unauthorized user
Certain Embedded systems have to make sure they conform to the
security measures. Ex. An Electronic Safety Deposit Locker can be
used only with a pin number like a password.
62
Safety
Safety deals with the possible damage that can happen
to the operating person and environment due to the
breakdown of an embedded system or due to the
emission of hazardous materials from the embedded
products.
A safety analysis is a must in product engineering to
evaluate the anticipated damage and determine the best
course of action to bring down the consequence of
damages to an acceptable level.
63
Non-Operational Quality Attributes
These are attributes not related to operation or functioning of
an embedded system. The way an embedded system operates
affects its overall quality.
These are the attributes that are associated with the embedded
system before it can be put in operation.
1. Testability and Debug-Ability
2. Evolvability
3. Portability
4. Time to Prototype and Market
5. Per Unit and Total Cost
64
Testability and Debug-Ability
It deals with how easily one can test his/her design,
application and by which mean he/she can test it.
In hardware testing the peripherals and total hardware
function in designed manner
Firmware testing is functioning in expected way
Debug-ability is means of debugging the product as such
for figuring out the probable sources that create unexpected
behavior in the total system
65
Evolvability
For embedded system, the qualitative attribute
“Evolvability” refer to ease with which the embedded
product can be modified to take advantage of new
firmware or hardware technology.
66
Portability
Portability is measured of “system Independence”.
An embedded product can be called portable if it is
capable of performing its operation as it is intended to
do in various environments irrespective of different
processor and or controller and embedded operating
systems.
67
Time to Prototype and Market
Time to Market is the time elapsed between the
conceptualization of a product and time at which the
product is ready for selling or use
Product prototyping help in reducing time to market.
Prototyping is an informal kind of rapid product
development in which important feature of the under
consider are develop.
In order to shorten the time to prototype, make use of all
possible option like use of reuse, off the self component etc.
68
Per Unit and Total Cost
Cost is an important factor which needs to be carefully monitored.
Proper market study and cost benefit analysis should be carried out
before taking decision on the per unit cost of the embedded product.
When the product is introduced in the market, for the initial period
the sales and revenue will be low
There won’t be much competition when the product sales and
revenue increase.
During the maturing phase, the growth will be steady and revenue
reaches highest point and at retirement time there will be a drop in
sales volume.
69
Review Questions I
1. What is an embedded system? Explain the different applications of
embedded systems.
2. Difference between embedded systems and general computing
systems.
3. Describe the various purposes of embedded systems. Explain
any two in detail with illustrative examples.
4. Explain the characteristics of an embedded system.
5. Explain the Operational Quality Attributes of an embedded system
6. Explain the non quality attributes of an embedded system
70