ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected])
Introduction to Embedded Systems
Dongkun Shin ([email protected])
Embedded Software Laboratory
Sungkyunkwan University
http://nyx.skku.ac.kr/
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 2
Embedded Systems Everywhere
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 3
Definition
• Embedded System (ES):
any device that includes a programmable
computer but is not itself a general-purpose
computer.
– Take advantage of application characteristics to optimize
the design
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 4
Embedded Systems
• Features– Designed to perform a specific task or function– Invisible to end user– Defined by standard– Cyber-physical systems– Real-time– Low Power– Cost-sensitive
• Consumer devices– Internet-enabled TV, Blu-ray players, video game consoles,
streaming Internet TV devices, printers• Communications– Wifi router, ADSL modem, DSLAM, IP router• Control Systems– Motor controllers, actuators, sensors, PLCs, control panels
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 5
Where are the CPUs?
• Estimated 98% of 8 billion
CPUs produced in 2000
used for embedded
applications
• Smartphone shipments
(101M) surpass PCs
(2010Q4)
8.5B Parts per Year
Robots6%
Vehicles12%
Direct2%
Source: DARPA/Intel (Tennenhouse)
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 6
Embedded Processors
• Microcontroller (μC or MCU)
– A small computer on a single IC containing a
processor core, memory, and I/O peripherals
• Microprocessor
– A general-purpose CPU in a single chip
• SoC (System-on-a-Chip)
– More integration than MCU
– Mostly, require external memory
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 7
Early History (1)
• Intel 4004 (1971)
– The first microprocessor (4-bit)
– Originally designed for use in a calculator
– The first complete CPU on one chip
– The first commercially available microprocessor
– 2300 transistors @ 108KHz
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 8
Early History (2)
• Automobiles used microprocessor-based engine
controllers starting in 1970’s
– Control fuel/air mixture, engine timing, etc.
– Multiple modes of operation: warm-up, cruise, hill
climbing, etc.
– Provides lower emissions, better fuel efficiency
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 11
Digital Still Camera
Canon EOS3 uses three microprocessors for auto-focus, etc. (1998)
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 12
Digital TV
Programmable CPUs + hardwired logic for video/audio decode, etc.
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 13
iPhone 7
Apple A10 AP &
Samsung 2GB
LPDDR4 DRAM
Qualcomm
LTE Modem
Avago
PowerAmplifiers
SK Hynix
32GB Flash
Dialog & Qualcomm
Power Management ICs
Qualcomm
LTE Transceiver
Qualcomm
RF Transceiver
Bosch Barometric
Pressure Sensor
Apple/Cirrus Logic
Audio Codec
Cirrus Logic
Audio Amplifiers
NXP NFC
Controller
Murata Wi-Fi/Bluetooth
Module
Source: https://www.ifixit.com/Teardown/iPhone+7+Teardown/67382
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 14
Fitbit Flex
STMicroelectronics 32L151C6
Ultra Low Power ARM Cortex M3
Microcontroller
Nordic Semiconductor nRF8001
Bluetooth Low Energy IC
Charger IC: TI BQ24040
Accelerometer IC?
Source: https://www.ifixit.com/Teardown/Fitbit+Flex+Teardown/16050
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 15
DJI Phantom 2 Drone
Source: http://www.nytimes.com/2014/09/11/technology/personaltech/a-teardown-of-the-phantom-2-vision-plus-drone-from-dji.html
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 16
Automobile
• A high-end automobile
– > 100 microprocessors
– 4-bit microcontroller
checks seat belt
– Microcontrollers run
dashboard devices
– 16/32-bit
microprocessor
controls engine
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 17
Solid State Drive (SSD)
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 18
Want More?
• You name it!
And the list goes on and on …
Anti-lock brakes
Auto-focus cameras
Automatic teller machines
Automatic toll systems
Automatic transmission
Avionic systems
Battery chargers
Camcorders
Cell phones
Cell-phone base stations
Cordless phones
Cruise control
Curbside check-in systems
Digital cameras
Disk drives
Electronic card readers
Electronic instruments
Electronic toys/games
Factory control
Fax machines
Fingerprint identifiers
Home security systems
Life-support systems
Medical testing systems
Modems
MPEG decoders
Network cards
Network switches/routers
On-board navigation
Pagers
Photocopiers
Point-of-sale systems
Portable video games
Printers
Satellite phones
Scanners
Smart ovens/dishwashers
Speech recognizers
Stereo systems
Teleconferencing systems
Televisions
Temperature controllers
Theft tracking systems
TV set-top boxes
VCR’s, DVD players
Video game consoles
Video phones
Washers and dryers
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 19
ES Characteristics (1)
• Single-functioned
– Executes a single program, repeatedly
• Sophisticated functionality
– Often have to run sophisticated algorithms or multiple
algorithms
• Cell phone, laser printer, digital TV, etc.
– Often provide sophisticated user interfaces
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 20
ES Characteristics (2)
• Reactive and real-time operation:
Must finish operations by deadlines
– Continually reacts to changes in the systems
environment
– Hard real-time: missing deadline causes failure
– Soft real-time: missing deadline results in degraded
performance
– Many systems are multi-rate:
Must handle operations at widely varying rate
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 21
ES Characteristics (3)
• Low cost
– Manufacturing cost
• The monetary cost of manufacturing each copy
– NRE (Non-Recurring Engineering) cost
• The one-time monetary cost of designing the system
– Many embedded systems are mass-market items that
must have low manufacturing cost
– Limited memory, microprocessor power, etc.
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 22
ES Characteristics (4)
• Low power
– Power consumption is critical in battery-powered
devices
– Excessive power consumption increases system cost
even in wall-powered devices
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 23
ES Characteristics (5)
• Designed to tight deadlines by small teams
– Often designed by a small team of designers
– Often must meet tight deadlines
• 6-month time-to-market is common
• Can’t miss back-to-school window for calculator
– Many design alternatives
– Hard to develop and debug
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 24
Challenges in ES Design (1)
• How much hardware do we need?– Powerful CPU? Big memory?
• OS or Firmware?
• How do we meet our deadlines?– Faster hardware or cleverer software?
• How do we minimize power?– Turn off unnecessary logic? Reduce memory accesses?
• How do we design for upgradeability?– e.g. Evolution Kit in Samsung Digital TVs
• Time-to-market?
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 25
Challenges in ES Design (2)
• Does it really work?
– Is the specification correct?
– Does the implementation meet the spec?
– How do we test for real-time characteristics?
– How do we test on real data?
– Does it work reliably?
• How do we work on the system?
– Limited observability and controllability
– Restricted development environments
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 26
Challenges in ES Design (3)
• Optimizing design metrics
– Improving one may worsen others
– Expertise with both software and hardware is needed to
optimize design metrics
– A designer must be
comfortable with various
technologies in order to
choose the best for a given
application and constraints
SizePerformance
Power
NRE cost
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 2727
Challenges for implementation ES
• Implementation in HW
– Lack of flexibility (changing standards).
– Mask cost for specialized HW becomes very expensive
• Trend towards implementation in Software
• Implementation in SW
– Exponential increase in software complexity
– In some areas code size is doubling every 9 months
–... > 70% of the development cost for complex systems such as automotive electronics and communication systems are due to software development
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 28
28
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
Application-specific
Registers
Custom
ALU
DatapathController
Program memory
Assembly code
for:
total = 0
for i =1 to …
Control logic
and State
register
Data
memory
IR PC
Single-purpose (“hardware”)
DatapathController
Control
logic
State
register
Data
memory
index
total
+
IR PC
Register
file
General
ALU
DatapathController
Program memory
Assembly code
for:
total = 0
for i =1 to …
Control
logic and
State register
Data
memory
General-purpose (“software”)
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 29
29
Processor technology
• Processors vary in their customization for the problem at hand
total = 0
for i = 1 to N loop
total += M[i]
end loop
General-purpose
processor
Single-purpose
processor
Application-specific
processor
Desired
functionality
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 30
30
General-purpose processors
• Programmable device used in a variety of applications
– Also known as “microprocessor”
• Features– Program memory
– General datapath with large register file and general ALU
• User benefits– Low time-to-market and NRE costs
– High flexibility
• “ARM” the most well-known, but there are hundreds of others
IR PC
Register
file
General
ALU
DatapathController
Program
memory
Assembly code
for:
total = 0
for i =1 to …
Control
logic and
State register
Data
memory
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 31
31
Single-purpose processors
• Digital circuit designed to execute exactly
one program
– a.k.a. coprocessor, accelerator or peripheral
• Features
– Contains only the components needed to execute
a single program
– No program memory
• Benefits
– Fast
– Low power
– Small size
DatapathController
Control
logic
State
register
Data
memory
index
total
+
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 32
32
Application-specific processors
• Programmable processor optimized for a
particular class of applications having
common characteristics
– Compromise between general-purpose and
single-purpose processors
• Features
– Program memory
– Optimized datapath
– Special functional units
• Benefits
– Some flexibility, good performance, size and
power
IR PC
Registers
Custom
ALU
DatapathController
Program
memory
Assembly code
for:
total = 0
for i =1 to …
Control
logic and
State register
Data
memory
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 33
TI C62/C67 (High Performance DSP)
• Up to 8 instructions/cycle.
• 32 32-bit registers.
• Function units:– Two multipliers.
– Six ALUs.
• All instructions execute conditionally.
• Data operations– 8/16/32-bit arithmetic.
– 40-bit operations.
– Bit manipulation operations.
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 34
Freescale Starcore SC140
• DALU includes 4 ALUs, 1 register file.
• AGU includes 2 address arithmetic units (AAU), 1 address register file.
• Program sequencer and control unit (PSEQ).
• Performance:– 4 million MACs per
second per MHz clock.
– 10 RISC MIPS per MHz clock.
SC140 Core
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 35
SC140 Instruction format
• 16-bit instructions.
• Up to 6 instructions per cycle.
• Instructions are grouped to define allowable simultaneous operations.
• Allowable addressing modes:
– linear, modulo, multiple
– wrap-around modulo, and reverse-carry.
• Array addressing: base, offset, modifier registers.
1. The contents of the D0 and D1 registers are multiplied fractionally. The result is subtracted from the D7 data register. The final result is then rounded and stored in the D7 data register.2. The contents of the D4 and D5 registers are ANDed together. The result is stored in the D5 data register.3. The contents of the data memory location (pointed to by the R0 register) are moved into the R6 register.4. The address in the R0 register is incremented by the contents of the N0 register.5. The contents of R2 are added to the R3 register. This result is stored back in the R3 register.
Four SC140 Instructions in an Execution Set
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 36
Typical Smart Phone System Architecture
• SoC
– comprises a CPU and a bunch of
peripheral controllers all on the
same Integrated-Circuit (IC) die
• All other components on the
target's board are typically
connected in one way or
another to the SoC
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 37
Integrated Mobile Processor
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 38
System-on-Chip (SoC)• Multi-core
– The Linux kernel has supported symmetric multi-processing, so it can handle a multi-core SoC.
– Android stack itself doesn't contain any specific multi-core optimizations.
• Graphics Processing Unit (GPU)
– accelerating the rendering of graphics to the device's display
• RAM controller: Interfaces with the on-board RAM.
• DMA: Handles the automated transfers of data between the RAM and memory-mapped hardware.
• USB controller: Manages the hardware-side of the device's USB connections.
• DSP: Provides hardware acceleration for some signal processing, such as JPEG encoding.
• Display: Enables the SoC to drive various display types.
• Camera: Allows the SoC to interface with a camera.
• Storage: Manages I/O with the various types of storage that can be used with the SoC.
• Debug: Enables the SoC to be connected to hardware debugging tools through various types of mechanisms such as JTAG.
• Crypto and security functionality
– locking the device and denying the opportunity for unauthorized code to run.
ICE3028: Embedded Systems Design, Fall 2019, Dongkun Shin ([email protected]) 40
Development Setup• Serial connection (RS232)
– allows to interact with the board's bootloader, upload/download small files
– interact with the target when nothing else works.
– slow and for basic interaction
– Serial support is usually provided by the bootloader and the kernel board
• Ethernet
– transfer large amounts of data
– DHCP to retrieve its IP configuration,
– TFTP to load its kernel images
– NFS to mount root filesystem
– require a proper driver for the Ethernet chip used on your board
• USB (Android)
– connect to the target using ADB
– shelling into the target
– forwarding ports, updating filesystems
– you can configure ADB to run over IP