Advanced Embedded Systems
Third & Fourth Years – Second Semester
Dr. Salah Eldin Shaban
Advanced Embedded Systems Dr. Salah Eldin Shaban 1
Course Objectives
This course will enable the students to:
Provide the basics of embedded system design principles.
Learn the design process of embedded system applications.
Understand the typical components of an embedded system, the
concepts of real-time operating systems (RTOSs), the inter-process
communication, and the different communication interfaces.
Provide exposure to embedded system development tools with
hands on experience in using basic programming techniques.
Advanced Embedded Systems Dr. Salah Eldin Shaban 2
Course Outcomes
Upon completion of this course, the students will be able to:
Understand and design the embedded systems.
Learn the basics of OS and RTOS.
Understand types of memory and interfacing to external world.
Understand embedded firmware design approaches.
Advanced Embedded Systems Dr. Salah Eldin Shaban 3
Course Materials
Text Books
Marilyn Wolf, Computer as Components: Principles of Embedded
Computing System Design 4th Edition, Morgan Kaufmann – Elsevier, 2016.
Xiaocong Fan, Real-Time Embedded Systems: Design Principles
and Engineering Practices, Elsevier Inc., Copyright © 2015. ISBN:
978-0-12-801507-0
Other Recommended Books
Peter Marwedel, Embedded System Design: Embedded Systems
Foundations of Cyber-Physical Systems 3rd Edition, Springer
Dordrecht Heidelberg London New York, 2017.
Meikang Qiu and Jiayin Li, Real-Time Embedded Systems: Optimization,
Synthesis, and Networking, Taylor & Francis Group, LLC, 2011.
Advanced Embedded Systems Dr. Salah Eldin Shaban 4
Grading
Grading is based on:
Oral and Practical Exam: 20 %
Midterm and Term Work: 20 %
Midterm Exam at Week 8
Final Written Exam: 60 %
Final Term Exam at Week 16
Advanced Embedded Systems Dr. Salah Eldin Shaban 5
Chapter One: Introduction to Embedded Systems
Objectives:
Computing Systems
Characteristics of Embedded Systems
Design Challenges
The Embedded System Design Process
Advanced Embedded Systems Dr. Salah Eldin Shaban 6
Computing Systems
Computing systems are everywhere.
Most of us think of “desktop” computers.
– PC’s
– Laptops
– Mainframes
– Servers
But there’s another type of computing system called embedded
systems.
– Far more common...
Advanced Embedded Systems Dr. Salah Eldin Shaban 7
Examples of Embedded Systems
Anti-lock brakes Modems
Auto-focus cameras MPEG decoders
Automatic teller machines Network cards
Automatic toll systems Network switches/routers
Automatic transmission On-board navigation
Avionic systems Pagers
Battery chargers Photocopiers
Camcorders Point-of-sale systems
Cell phones Portable video games
Cell-phone base stations Printers
Cordless phones Satellite phones
Cruise control Scanners
Curbside check-in systems Smart ovens/dishwashers
Digital cameras Speech recognizers
Disk drives Stereo systems
Electronic card readers Teleconferencing systems
Electronic instruments Televisions
Electronic toys/games Temperature controllers
Factory control Theft tracking systems
Fax machines TV set-top boxes
Fingerprint identifiers VCR’s, DVD players
Home security systems Video game consoles
Life-support systems Video phones
Medical testing systems Washers and dryers
And the list goes on and on
Advanced Embedded Systems Dr. Salah Eldin Shaban 8
What are Embedded Systems? Cont.
Advanced Embedded Systems Dr. Salah Eldin Shaban 9
Embedded Systems Vs General Computing Systems
General Purpose Computing System Embedded System
general purpose computers
1. A system which is a combination of generic HW and 1. A system which is a combination of special purpose
general purpose operating system (GPOS) for HW and embedded OS for executing a specific set
executing a variety of applications. of applications.
2. Contain a GPOS. 2. May or may not contain an OS for functioning.
3. Applications are alterable (programmable) by user (it 3. The firmware of the embedded system is pre-
is possible for the end user to re-install the OS, and programmed and it is non-alterable by the end-user.
add or remove user applications). 4. Application specific requirements (like performance,
4. Performance is the key deciding factor on the power requirements, memory usage etc.) are the
selection of the system. Always “faster is better‟. key deciding factors.
5. Less/not at all tailored towards reduced 5. Highly tailored to take advantage of the power
operating power requirements, options for saving modes supported by hardware and operating
different levels of power management. system.
6. Response requirements are not time critical. 6. For certain category of embedded systems like
7. Need not be deterministic in execution mission critical systems, the response time
behavior. requirement is highly critical.
mission critical systems 7. Execution behavior is deterministic for certain type
hard real time systems
of embedded systems like „hard real time‟ systems.
Advanced Embedded Systems Dr. Salah Eldin Shaban 10
Types of Embedded Systems
General Computing
Applications similar to desktop computing, but in an embedded
systems.
Video games, wearable computers, set-top boxes, automatic tellers.
Control Systems
Closed-loop feedback control of real-time systems.
Vehicle engines, chemical processes, nuclear power, flight control.
Signal Processing
Computations involving large data streams.
Radar, sonar, video compression.
Communication & Networking
Switching and information transmission.
Telephone system, Internet.
Advanced Embedded Systems Dr. Salah Eldin Shaban 11
A Block Diagram of an Embedded System
Control
(Output) Motor/Light
produce
System Bus
Observe Temperature
Processor (Input) Sensor
mem
Advanced Embedded Systems Dr. Salah Eldin Shaban 12
An Embedded System Example
BMW 850i Brake and Stability Control System
observer when i push on brake
control
bus system
processor
Advanced Embedded Systems Dr. Salah Eldin Shaban 13
Characteristics of Embedded Systems
Embedded systems have several common characteristics that
distinguish them from other computing systems.
Single-functioned
– Executes a single program, repeatedly.
Tightly-constrained
– Low cost, low power, small, fast, etc.
Reactive and real-time
– Continually reacts to changes in the system’s environment.
– Must compute certain results in real-time without delay.
any thing has an red color is very important ya man
Advanced Embedded Systems Dr. Salah Eldin Shaban 14
Characteristics of Embedded Systems Cont.
Embedded systems have to provide sophisticated functionality:
Complex algorithms: The operations performed by the microprocessor may
be very sophisticated.
User interface: Microprocessors are frequently used to control complex
user interfaces that may include multiple menus and many options.
Embedded computing operations must meet deadlines:
Real time: In some cases, failure to meet a deadline is unsafe and can even
endanger lives.
Multi-rate: Many embedded computing systems have several real-time
activities going on at the same time. They may simultaneously control
some operations that run at slow rates and others that run at high rates.
Advanced Embedded Systems Dr. Salah Eldin Shaban 15
Characteristics of Embedded Systems Cont.
Many Embedded Systems must meet real-time constraints:
A real-time system must react to stimuli from the controlled object
within the time interval dictated by the environment.
For real-time systems, right answers arriving too late (or even too
early) are wrong.
“A real-time constraint is called HARD, if not meeting that constraint
could result in a catastrophe“.
All other time-constraints are called SOFT.
A guaranteed system response has to be explained without statistical
arguments.
Advanced Embedded Systems Dr. Salah Eldin Shaban 16
Characteristics of Embedded Systems Cont.
Many Embedded Systems must be dependable:
Reliability: R(t) = probability of system working correctly provided
that is was working at t = 0.
Maintainability: M(d) = probability of system working correctly d
time units after error occurred.
Availability: probability of system working at time t.
Safety: no harm to be caused.
Security: confidential and authentic communication.
Even perfectly designed systems can fail if the assumptions
about the workload and possible errors turn out to be wrong.
Making the system dependable must not be an after-thought, it
must be considered from the very beginning.
Advanced Embedded Systems Dr. Salah Eldin Shaban 17
Characteristics of Embedded Systems Cont.
Many Embedded Systems must be efficient:
Energy efficient
Code-size efficient (especially for systems on a chip)
Run-time efficient
Weight efficient
Cost efficient
Dedicated towards a certain application: Knowledge about
behavior at design time can be used to minimize resources and
to maximize robustness.
Dedicated user interface (no mouse, keyboard and screen).
Advanced Embedded Systems Dr. Salah Eldin Shaban 18
Characteristics of Embedded Systems Cont.
Application-specific functionality: Specialized for one or one class
of applications.
Deadline constrained operation: System may have to perform its
function(s) within specific time periods to achieve successful results.
Resource challenged: Systems typically are configured with a modest
set of resources to meet the performance objectives.
Power efficient: Many systems are battery-powered and must conserve
power to maximize the usable life of the system.
Form factor: Many systems are light weight and low volume to be used
as components in host systems.
Manufacturable: Usually small and inexpensive to manufacture based
on the size and low complexity of the hardware.
Advanced Embedded Systems Dr. Salah Eldin Shaban 19
An Embedded System Example -- A Digital Camera
Digital camera chip
CCD
CCD preprocessor Pixel coprocessor D2A
A2D
lens
JPEG codec Microcontroller Multiplier/Accum
DMA controller Display ctrl
Memory controller ISA bus interface UART LCD ctrl
Single-functioned -- always a digital camera.
Tightly-constrained -- Low cost, low power, small, fast.
Reactive and real-time -- only to a small extent.
Advanced Embedded Systems Dr. Salah Eldin Shaban 20
Design Challenge – Optimizing Design Metrics
Obvious design goal:
– Construct an implementation with desired functionality.
Key design challenge:
– Simultaneously optimize numerous design metrics.
Design metric
– A measurable feature of a system’s implementation.
– Optimizing design metrics is a key challenge.
Common metrics
Unit cost: the monetary cost of manufacturing each copy of the system,
excluding NRE cost.
NRE cost (Non-Recurring Engineering cost): The one-time monetary
cost of designing the system.
Size: the physical space required by the system.
Advanced Embedded Systems Dr. Salah Eldin Shaban 21
Design Challenge – Optimizing Design Metrics Cont.
Common metrics
– Performance: the execution time or throughput of the system.
– Power: the amount of power consumed by the system.
– Flexibility: the ability to change the functionality of the system without
incurring heavy NRE cost.
– Time-to-prototype: the time needed to build a working version of
the system.
– Time-to-market: the time required to develop a system to the
point that it can be released and sold to customers.
– Maintainability: the ability to modify the system after its initial
release.
– Correctness, safety, many more.
Advanced Embedded Systems Dr. Salah Eldin Shaban 22
Design Challenge – Optimizing Design Metrics Cont.
Expertise with both software and hardware is needed to
optimize design metrics.
– Not just a hardware or software expert, as is common.
– A designer must be comfortable with various technologies in
order to choose the best for a given application and constraints.
Digital camera chip
CCD
CCD Pixel coprocessor D2A
A2D
preprocessor
lens
JPEG codec Microcontroller Multiplier/Accum
DMA controller Display ctrl Hardware
Power
Memory controller ISA bus interface UART LCD ctrl
Software
Performance Size
NRE cost
Advanced Embedded Systems Dr. Salah Eldin Shaban 23
Time-to-Market: a demanding design metric
Time required to develop a product to the point it can be sold to
customers.
Market window
– Period during which the product would have highest sales.
Average time-to-market constraint is about 8 months.
Delays can be costly.
Revenues ($)
Time (months)
Advanced Embedded Systems Dr. Salah Eldin Shaban 24
Losses due to Delayed Market Entry
Peak revenue
Simplified revenue model
– Product life = 2W, peak at W
Revenues ($)
Peak revenue from
delayed entry
On-time – Time of market entry defines a
Market Market fall triangle, representing market
rise penetration.
Delayed
– Triangle area equals revenue.
Loss
D W 2W
Time
– The difference between the on-
On-time Delayed
entry entry time and delayed triangle areas.
Advanced Embedded Systems Dr. Salah Eldin Shaban 25
Losses due to Delayed Market Entry Cont.
Area = 1/2 * base * height
– On-time = 1/2 * 2W * W
Peak revenue
– Delayed = 1/2 * (W-D+W)*(W-D)
Percentage revenue loss = (D(3W-
Revenues ($)
Peak revenue from
delayed entry
On-time D)/2W2)*100%
Market fall
Market
rise
Try some examples
Delayed – Lifetime 2W=52 wks, delay D = 4 wks
– (4*(3*26 –4)/2*26^2) = 22%
– Lifetime 2W=52 wks, delay D=10 wks
D W 2W
– (10*(3*26 –10)/2*26^2) = 50%
On-time Delayed Time
– Delays are costly!
entry entry
height = 0.5 base
Advanced Embedded Systems Dr. Salah Eldin Shaban 26
NRE and Unit Cost Metrics
Costs:
• Unit cost: the monetary cost of manufacturing each copy of the system,
excluding NRE cost
• NRE cost (Non-Recurring Engineering cost): The one-time monetary cost
of designing the system
• total cost = NRE cost + unit cost * # of units
• per-product cost = total cost / # of units
= (NRE cost / # of units) + unit cost
• Example
– NRE=$2000, unit=$100
– For 10 units
– total cost = $2000 + 10*$100 = $3000
– per-product cost = $2000/10 + $100 = $300
Amortizing NRE cost over the units
results in an additional $200 per unit
Advanced Embedded Systems Dr. Salah Eldin Shaban 27
NRE and Unit Cost Metrics Cont.
Compare technologies by costs -- best depends on quantity
• Technology A: NRE=$2,000, unit=$100
• Technology B: NRE=$30,000, unit=$30
• Technology C: NRE=$100,000, unit=$2
$200,000 $200
A A
B B
$160,000 $160
C C
tota l c ost (x1000)
p er p rod uc t c ost
$120,000 $120
$80,000 $80
$40,000 $40
$0 $0
0 800 1600 2400 0 800 1600 2400
Numb er of units (volume) Numb er of units (volume)
• But, must also consider time-to-market
Advanced Embedded Systems Dr. Salah Eldin Shaban 28
The Performance Design Metric
Widely-used measure of system, widely-abused
– Clock frequency, instructions per second – not good measures.
– Digital camera example – a user cares about how fast it processes images,
not clock speed or instructions per second.
Latency (response time)
– Time between task start and end.
– e.g., Camera’s A and B process images in 0.25 seconds.
Throughput
– Tasks per second, e.g. Camera A processes 4 images per second.
– Throughput can be more than latency seems to imply due to concurrency,
e.g. Camera B may process 8 images per second (by capturing a new image
while previous image is being stored).
Speedup of B over S = B’s performance / A’s performance
– Throughput speedup = 8/4 = 2
Advanced Embedded Systems Dr. Salah Eldin Shaban 29
Embedded System Technologies
Technology
– A manner of accomplishing a task, especially using technical
processes, methods, or knowledge.
Three Key Technologies for Embedded Systems
– Processor Technology.
– IC Technology.
– Design Technology.
Advanced Embedded Systems Dr. Salah Eldin Shaban 30
Processor Technology
The architecture of the computation engine used to implement a
system’s desired functionality.
Processor does not have to be programmable.
– “Processor” not equal to general-purpose processor.
Controller Datapath Controller Datapath Controller Datapath
Control Control index
Register file Control Registers
logic and logic
logic and total
State State State
Custom +
register register register
General ALU
IR PC ALU
IR PC
Data Data
memory memory
Program Data Program
memory memory memory
Assembly Assembly
code for: code for:
total = 0 total = 0
for i =1 to … for i =1 to …
Single-purpose (“hardware”)
General-purpose (“software”) Application-specific
Advanced Embedded Systems Dr. Salah Eldin Shaban 31
Processor Technology Cont.
Processors vary in their customization for the problem at hand.
total = 0
for i = 1 to N loop
total += M[i]
Desired Functionality end loop
General-Purpose Application-Specific Single-Purpose
Processor Processor Processor
Advanced Embedded Systems Dr. Salah Eldin Shaban 32
General-Purpose Processors
Programmable device used in a variety of
applications. Controller Datapath
– Also known as “microprocessor” Control Register
logic and file
Features State
register
– Program memory General
– General datapath with large register file and IR PC ALU
general ALU.
Program Data
User benefits memory memory
– Low time-to-market and NRE costs. Assembly
code for:
– High flexibility.
total = 0
“Pentium” the most well-known, but there are for i =1 to …
hundreds of others.
Advanced Embedded Systems Dr. Salah Eldin Shaban 33
Single-Purpose Processors
Digital circuit designed to execute exactly
one program. Controller Datapath
– a.k.a. coprocessor, accelerator or peripheral. Control index
logic
Features total
State
– Contains only the components needed to register +
execute a single program.
– No program memory. Data
memory
Benefits
– Fast
– Low power
– Small size
Advanced Embedded Systems Dr. Salah Eldin Shaban 34
Application-Specific Processors
Programmable processor optimized for a
particular class of applications having Controller Datapath
common characteristics. Control Registers
logic and
– Compromise between general-purpose and State
single-purpose processors. register
Custom
ALU
Features IR PC
– Program memory. Data
Program memory
– Optimized datapath. memory
– Special functional units. Assembly
code for:
Benefits
total = 0
– Some flexibility, good performance, size and for i =1 to …
power.
Advanced Embedded Systems Dr. Salah Eldin Shaban 35
IC Technology
The manner in which a digital (gate-level) implementation is
mapped onto an IC.
– IC: Integrated circuit, or “chip”.
– IC technologies differ in their customization to a design.
– IC’s consist of numerous layers (perhaps 10 or more).
• IC technologies differ with respect to who builds each layer and when
it is built.
Three Types of IC Technologies
– Full-custom/VLSI.
– Semi-custom ASIC (gate array and standard cell).
– PLD (Programmable Logic Device).
gate
IC package IC oxide
source channe drain
l Silicon
substrate
Advanced Embedded Systems Dr. Salah Eldin Shaban 36
Programmable Logic Device (PLD)
All layers already exist.
– Designers can purchase an IC.
– Connections on the IC are either created or destroyed to
implement desired functionality.
– Field-Programmable Gate Array (FPGA) very popular.
Benefits
– Low NRE costs, almost instant IC availability.
Drawbacks
– Bigger, expensive (perhaps $30 per unit), power hungry, slower.
Advanced Embedded Systems Dr. Salah Eldin Shaban 37
Moore’s Law
The most important trend in embedded systems.
– Predicted in 1965 by Intel co-founder Gordon Moore.
IC transistor capacity has doubled roughly every 18
months for the past several decades
Advanced Embedded Systems Dr. Salah Eldin Shaban 38
Moore’s Law Cont.
Wow
– This growth rate is hard to imagine, most people underestimate.
– How many ancestors do you have from 20 generations ago.
i.e., roughly how many people alive in the 1500’s did it take to make you?
220 = more than 1 million people.
– (This underestimation is the key to pyramid schemes!).
Advanced Embedded Systems Dr. Salah Eldin Shaban 39
Moore’s Law Cont.
1981 1984 1987 1990 1993 1996 1999 2002
10,000 150,000,000
transistors transistors
Leading edge Leading edge
chip in 1981 chip in 2002
Something that doubles frequently grows more quickly than
most people realize!
– A 2002 chip can hold about 15,000 1981 chips inside itself.
Advanced Embedded Systems Dr. Salah Eldin Shaban 40
Design Technology
The manner in which we convert our concept of desired system
functionality into an implementation.
Compilation/ Libraries/ Test/
Synthesis IP Verification
System System HW/SW/ Model Simulate./
Compilation/Synthesis: specification synthesis OS Checkers
Automates exploration and
insertion of implementation
details for lower level.
Behavioral Behavior Cores HW-SW
specification synthesis Co-simulators
Libraries/IP: Incorporates
pre-designed implementation
from lower abstraction level
into higher level. RT RT RT HDL simulators
specification synthesis components
Test/Verification: Ensures
correct functionality at each
level, thus reducing costly Logic Logic Gates/ Gate
iterations between levels. specification synthesis Cells Simulators
To final implementation
Advanced Embedded Systems Dr. Salah Eldin Shaban 41
Design Technology Cont.
A system implementation must be:
quickly optimize design metrics.
Designers must be improve design technology to enhance productivity.
To improve the design process, understand the design process itself.
A top-down design process is illustrated above.
The designer refines the system through several abstraction levels.
System level: describe the desired functionality or specification of
the system in a language such as C.
Behavioral level: distribute portions of a system among several
general and/or single-purpose processors.
Advanced Embedded Systems Dr. Salah Eldin Shaban 42
Design Technology Cont.
Register-transfer (RT) level: convert behavior on GPPs to assembly
code, and behavior on SPPs to a connection of register-transfer
components and state machines. Then, refine the register-transfer-
level specification of a SPP into a logic specification consisting of
Boolean equations; no refinement of a GPP's assembly code is done
at this level.
Logic Level: refine the remaining specifications into an
implementation, consisting of machine code for GPPs and a gate-
level netlist for SPPs.
Advanced Embedded Systems Dr. Salah Eldin Shaban 43
Design Technology Cont.
There are three main approaches to improve the design process:
Compilation/Synthesis
Specify desired functionality in an abstract manner and
automatically generates lower-level implementation details.
Libraries/IP
Reuse pre-existing implementations.
Test/Verification
Ensure the system functionality is correct.
Several other approaches also exist.
Each approach can be applied at any of the four abstraction levels.
Advanced Embedded Systems Dr. Salah Eldin Shaban 44
Design Technology Cont.
100,000
10,000
(K) Trans./Staff – Mo.
1,000
100
Productivity
10
0.1
0.01
2005
1993
2003
2001
1983
1987
1985
1991
1989
1999
1997
2007
1995
2009
Exponential increase over the past few decades.
Advanced Embedded Systems Dr. Salah Eldin Shaban 45
The Co-design Ladder
In the past: Sequential program code (e.g., C, VHDL)
– Hardware and software design Compilers
Behavioral synthesis
(1990's)
technologies were very different. (1960's,1970's)
Register transfers
– Recent maturation of synthesis Assembly instructions RT synthesis
enables a unified view of hardware Assemblers, linkers
(1980's, 1990's)
and software. (1950's, 1960's) Logic equations / FSM's
Logic synthesis
Hardware/Software “Co-design” Machine instructions (1970's, 1980's)
means the simultaneous design of Logic gates
hardware and software to meet
system objective
Implementation
Microprocessor plus VLSI, ASIC, or PLD
program bits: “software” implementation: “hardware”
The choice of hardware versus software for a particular function is simply a tradeoff
among various design metrics, like performance, power, size, NRE cost, and especially
flexibility; there is no fundamental difference between what hardware or software can
implement.
Advanced Embedded Systems Dr. Salah Eldin Shaban 46
Independence of Processor and IC Technologies
Basic tradeoff
– General vs. custom.
– With respect to processor technology or IC technology.
– The two technologies are independent.
General- Single-
purpose ASIP purpose
General, processor processor Customized,
providing improved: providing improved:
Flexibility Power efficiency
Maintainability Performance
NRE cost Size
Time- to-prototype Cost (high volume)
Time-to-market
Cost (low volume)
PLD Semi-custom Full-custom
Advanced Embedded Systems Dr. Salah Eldin Shaban 47
Design Productivity Gap
While designer productivity has grown at an impressive rate
over the past decades, the rate of improvement has not kept pace
with chip capacity.
chip doesnot keep pace with growth of ICs
transistor capacity
10,000 100,000
1,000 10,000
Logic transistors100 1000
per chip 10 Gap 100 Productivity
(in millions) IC capacity (K) Trans./Staff-Mo.
1 10
0.1 1
productivity
0.01 0.1
0.001 0.01
Advanced Embedded Systems Dr. Salah Eldin Shaban 48
Design Productivity Gap Cont.
1981 leading edge chip required 100 designer months.
– 10,000 transistors / 100 transistors/month.
2002 leading edge chip requires 30,000 designer months.
– 150,000,000 / 5000 transistors/month.
Designer cost increase from $1M to $300M.
10,000 100,000
1,000 10,000
Logic transistors100 1000
per chip 10 Gap 100 Productivity
(in millions) IC capacity (K) Trans./Staff-Mo.
1 10
0.1 1
productivity
0.01 0.1
0.001 0.01
Advanced Embedded Systems Dr. Salah Eldin Shaban 49
Design Productivity Gap Cont.
The situation is even worse than the productivity gap indicates.
In theory, adding designers to team reduces project completion time.
In reality, productivity per designer decreases due to complexities of
team management and communication.
In the software community, known as “the mythical man-month”.
At some point, can actually lengthen project completion time! (“Too
many cooks”).
Team
60000 16 15 16
• 1M transistors, 1 designer = 18
50000 19
5000 trans/month
40000 24 23
• Each additional designer 30000
reduces for 100 trans/month Months until completion
20000 43
• So 2 designers produce 4900 10000 Individual
trans/month each
0 10 20 30 40
Number of designers
Advanced Embedded Systems Dr. Salah Eldin Shaban 50
?
Advanced Embedded Systems Dr. Salah Eldin Shaban 51