Introduction to Embedded
Systems
By
AMIT
Learning
Version:
1.0
Document History
For
instructors
Only
Version
Author
Date
Comment
1.0
Nael
El-‐Ashi
20
July
2015
Ini>al
Version
What
is
an
Embedded
System?
• Any
sort
of
device
which
includes
a
programmable
computer
but
itself
is
not
intended
to
be
a
general-‐purpose
computer.
Watch:
What
is
Embedded
System
Video
Embedded
System
Applica>ons
Embedded
System
Applica>ons
Consumer
Products
Medical
Systems
Automobiles
TV
pace
maker,
pa>ent
engine
management,
trip
Stereo
monitoring
systems,
computer,
cruise
control,
remote
control
injec>on
systems,
phone
/
mobile
phone
immobilizer,
car
alarm,
Refrigerator
intensive
care
units,
…
airbag,
ABS,
ESP,
…
Microwave
Office
Equipment
Building
Systems
washing
machine
printer,
copier,
fax,
…
elevator,
heater,
air
electric
tooth
brush
Tools
oven
/
bread
cooker
mul>meter,
oscilloscope,
condi>oning,
ligh>ng,
key
Watch
line
tester,
GPS,
…
card
entries,
locks,
alarm
alarm
clock
Banking
systems,
…
electronic
toys
(stuffed
ATMs,
statement
printers,
Agriculture
animals,
handheld
toys,
pinball's,
etc.)
…
feeding
systems,
milking
TransportaDon
systems,
…
(Planes/Trains/ Space
[Automobiles]
and
Boats)
satellite
systems,
…
radar,
traffic
lights,
signaling
systems,
…
Embedded
System
ProducDon
Embedded
SW
size
and
deployment
Embedded
System
ProducDon
Complexity
growth
of
Embedded
Systems
Embedded
System
Applica>ons
AutomoDve
Example
Modern
Cars:
About
100
ECU
Embedded
System
Applica>ons
AutomoDve
Example
Watch:
PARK4U
Demo
Video
ES
History
Early
computers
(1940s)
-‐-‐>
dedicated
to
a
single
purpose
task.
First
modern
embedded
system
was
the
Apollo
Guidance
Computer,
developed
by
Charles
Stark
Draper
at
the
MIT
Instrumenta>on
Laboratory.
ES
History
• Since
these
early
applica>ons
in
the
1960s,
embedded
systems
have
come
down
in
price
and
there
has
been
a
drama>c
rise
in
processing
power
and
func>onality.
• The
first
microprocessor
(the
Intel
4004
)was
designed
for
calculators
and
other
small
systems
but
s>ll
required
many
external
memory
and
support
chips.
ES
History
• By
the
mid-‐1980s,
most
of
the
common
previously
external
system
components
had
been
integrated
into
the
same
chip
as
the
processor
and
this
modern
form
of
the
microcontroller
allowed
an
even
more
widespread
use.
Embedded System
Characteristics
CharacterisDcs
1)
Special-‐purpose
– Typically,
is
designed
to
execute
a
single
program,
repeatedly.
– It
used
to
be
single-‐purpose
– Now,
mul>-‐func>oned,
but
single-‐purpose.
CharacterisDcs
2)
Tightly
constrained
– Low
cost
– Simple
systems
– Fewer
components
based
– Performs
func>ons
fast
enough
– Minimum
power
CharacterisDcs
3)
Reac>ve
and
real-‐>me
– Reac>ve:
Con>nually
reacts
to
external
events
– Real-‐>me:
Must
compute
certain
results
in
real-‐>me
CharacterisDcs
4)
Hardware
and
sokware
co-‐exist
– The
sokware
wrilen
for
embedded
systems
is
oken
called
firmware
– Is
stored
in
read-‐only
memory
or
Flash
memory
chips
rather
than
a
disk
drive
CharacterisDcs
5)
Efficient
and
effec>ve
– Cost
effec>ve
– Power
efficiently
– Real-‐>me
– Predictability
ES
VS
GP
Systems
What
is
a
Microcontroller?
Usually
a
simple
microprocessor
plus
peripheral
support
devices
integrated
in
a
single
package.
Microcontroller
vs.
Microprocessor
Inside
a
Microcontroller
..
µC Components
CPU
µC
Components:
CPU
µC
Components:
CPU
Architecture
µC
Components:
CPU
CISC
vs.
RISK
µC
Components:
CPU
InstrucDon
Cycle
µC
Components:
CPU
instrucDon
pipelining
µC
Components:
Memory
µC
Components:
Memory
µC
Components:
Memory
µC
RAM
Divisions
I/O
and
GP
peripherals
Data
Ram
Registers
Registers
Stack
µC
Components:
Memory
Example:
AVR
µC
Components:
Peripherals
µC
Components:
I/O
Devices
Addressing
Isolated
vs.
Memory
Mapped
I/O
µc Case study
Atmel
AVR
µC
Vendor,
Family
and
Core
•Vendor
(ex.
ATMEL)
•Core
(ex.
ARM
and
AVR)
•Core
Family
(ex.
ATMEGA
and
SAM
families)
µC
Vendor
Examples
AVR
Family
•AVRs
are
generally
classified
into
three
broad
groups
(Families):
1.Tiny
AVRs.
2.Mega
AVRs.
3.Applica>on
specific
AVRs.
AVR
Family
• Tiny
AVRs
1-‐8
KB
program
memory
8-‐20-‐pin
package
Limited
peripheral
set
• Mega
AVRs
4-‐256
KB
program
memory
28-‐100-‐pin
package
Extensive
peripheral
set
• ApplicaDon
specific
AVRs
Mega
AVRs
with
special
features,
such
as
LCD
controller,
USB
controller,
advanced
PWM
etc.
AVR
core
Architecture
AVR
core
Architecture
Input
and
Output
(GPIO
or
DIO)
• 1.PORTA(PA7……..PAO)
• 2.PORTB(PB7….…..PBO)
• 3.PORTC(PC7….…..PCO)
• 4.PORTD(PD7……..PDO)
Input
and
Output
(GPIO
or
DIO)
• Each
PORT
is
controlled
by
3
registers:
• 1.DDRx(Data
Direc>on
Register)
• 2.PORTx(Output
Register)
• 3.PINx(Input
Register)
Note:
Most
pins
in
μC
make
more
than
one
func>on(mul>plexed
func>ons)
TIMERS
• Timers
0,1,
&
2.
• 8bit
&
16
bit.
• Input
capture
&
Output
compare.
• PWM.
Watchdog
Timer
Analog
to
Digital
Conversion
(ADC)
-‐
Range.
-‐
Resolu>on.
-‐
Applica>on.
Serial
Interface
UART
SPI
I²C
interrupt
unit
interrupt
unit
• SW
vs.
HW
Interrupt.
• Interrupt
Service
Rou>ne
(ISR).
• Interrupt
Vector
Table.
• Interrupt
vs.
Polling.
interrupt
unit
Mul>ple
Interrupts
interrupt
unit
AVR
Interrupts
Embedded Software
vs.
Desktop
applica>ons
Main
Features
of
Embedded
SW
•
Func>onality
represented
by
states
and
events.
•
Real-‐>me
behavior
of
events
and
expected
ac>ons.
•
Combined
sokware/hardware
systems
equipped
with
distributed
sokware,
computers,
sensors,
and
actuators.
•
high
demands
on
availability,
safety
and
informa>on
security.
•
long-‐lived
systems
in
which
embedded
sokware
is
expected
to
work
reliably.
• Response
>me
constraint
and
strict
deadlines.
• Energy
efficiency
Applica>ons.
• Op>mal
memory
usage
and
speed.
Programming
environments
• Need
of
direct
accessing
to
HW.
• More
than
80
percent
of
all
companies
are
using
C
and
to
some
degree
C++.
• More
than
40
percent
are
using
assembler
for
lower-‐level
interfaces.
• Java
is
increasingly
used
for
GUI
and
applica>on
programming.
C
Language
..
Why?
So\ware
pracDces
• Mathema>cal
modeling
for
reliability,
power
consump>on,
thermal,
and
performance
analysis.
• Formal
design
and
code
inspec>ons.
• Automated
sta>c
code
analysis
for
memory,
performance,
and
security.
• Automa>c
tes>ng.
• Model-‐driven
design
and
test.
• Adop>on
to
CMMI
levels
3
and
above
(in
fact
the
CMMI
was
created
by
explicit
demand
from
the
embedded-‐sokware
industries).
• Components
that
are
explicitly
designed
for
reuse.
So\ware
Life
Cycle
So\ware
Quality
VerificaDon
and
unit
tesDng
validaDon
Component
Peer
Reviews
tesDng
VerificaDon
and
IntegraDon
tesDng
validaDon
FuncDonal
and
Non-‐
staDc
code
analysis
FuncDonal
TesDng
CMMI
• Capability
Maturity
Model
Integra>on.
• level
3
organiza>ons
-‐>
98%
removal
effec>veness.
• Maturity
level
5
organiza>ons
in
embedded-‐
sokware
systems,
such
as
Boeing
or
Motorola,
achieve
99%
and
higher
removal
effec>veness.
• The
average
defect-‐removal
effec>veness
at
release
of
applica>on
sokware
and
informa>on
systems
is
only
about
85%.
Projects
and
ProducDvity
• Cost
and
efficiency
are
the
focus
of
embedded-‐
sokware
development.
• The
two
major
cost
drivers
in
embedded-‐
sokware
development
are
requirements
and
tes>ng.
• Safety
and
security.
Software & Hardware
Tools
What
do
you
need
to
write
a
program?
• Text
Editor.
• Compiler/Assembler.
• Linker.
What
is
an
IDE?
An
Integrated
Development
Environment
(IDE)
is
a
sokware
applica>on
that
provides
comprehensive
facili>es
to
computer
programmers
for
sokware
development.
Consists
of:
-‐
Source
code
editor
-‐
Compiler
and/or
Interpreter
-‐
Build
automa>on
tools
-‐
Debugger
Examples:
-‐
Eclipse
-‐
NetBeans
-‐
MonoDevelop
-‐
CodeWarrior
Debugger
• A
debugger
or
debugging
tool
is
a
computer
program
that
is
used
to
test
and
debug
other
programs.
• The
code
to
be
examined
might
alterna>vely
be
running
on
an
instruc>on
set
simulator
.
• When
the
program
crashes,
the
debugger
shows
the
actual
posi>on
in
the
original
code
if
it
is
a
source-‐level
debugger.
•
If
it
is
a
low-‐level
debugger
or
a
machine-‐language
debugger
it
shows
that
line
in
the
program.
Simulator
• Simulator
is
a
piece
of
Hardware/Sokware
that
simulates
another
system.
• for
example
a
flight
simulator
allows
you
to
experience
what
it
is
like
to
fly
an
aircrak,
a
driving
simulator
to
experience
driving
etc..
•
Simulator
tests
the
program
on
the
development
processor(the
processor
on
which
we
are
working).
Simulator
HW
Simulator
SW
Simulator
Flight
Simulator
Proteus
Emulator
• An
emulator
is
a
piece
of
Hardware/Sokware
that
enables
one
computer
system
to
run
programs
that
are
wrilen
for
another
computer
system.
• It
contains
the
max
RAM
&
ROM
size
and
all
the
peripherals
and
registers
the
could
exist
in
a
microcontroller
in
this
family.
•
It
is
FPGA
that
implement
the
core
of
the
MC.
• It
permits
the
programmer
to
make
a
hardware
breakpoints
and
halt
the
hardware
registers,
so
the
programmer
simply
could
debug
the
constraints
in
real-‐
>me
manners.
Emulator
HW
Emulator
SW
Emulator
In
Circuit
Emulator
• Simply
it
is
the
emulator
connected
to
the
board
as
if
it
is
the
MC
itself
and
at
this
>me
I
could
emulate
the
I/O
ports
and
other
func>onali>es
in
my
system.
• It
is
done
by
making
the
board
without
the
MC
then
connect
the
emulator
in
the
MC
place.
Programmer/Flasher
• It
is
hardware
used
in
order
to
Download
the
code
to
the
Microcontroller
ROM(Flash/
EEPROM).
Logical
Analyzer
Pulse
Generator
Thank you