Upload
lamquynh
View
244
Download
0
Embed Size (px)
Citation preview
1
www.ntnu.no TDT4258
Lecture 1: Introduction to Embedded Systems
Asbjørn DjupdalARM Norway and IDI, NTNU2013
www.ntnu.no TDT4258
2
www.ntnu.no TDT4258
Lecture overview
• Introduction
• Characteristics of embedded computers
• Embedded system design
• Design process examples
3
www.ntnu.no TDT4258
Lecture overview
• Introduction
• Characteristics of embedded computers
• Embedded system design
• Design process examples
4
www.ntnu.no TDT4258
Embedded systems
Any device that includes a programmable computer but is not itself a general-purpose computer
5
www.ntnu.no TDT4258
Examples
• Washing machine• Quartz wristwatch• PC keyboard• Printer• TV, radio• GPS• Digital camera
Embedded systems are everywhere!
6
www.ntnu.no TDT4258
Example: Automotive
• Over 100 embedded processors– Check seat belt– Dashboard devices– Engine control– Brake system– ...
• Many different systems with various processing and communication needs
7
www.ntnu.no TDT4258
Lecture overview
• Introduction
• Characteristics of embedded computers
• Embedded system design
• Design process examples
8
www.ntnu.no TDT4258
Characteristics of embedded systems• Take advantage of application characteristics to
optimize the design
• Very varied– From simple to sophisticated functionality– May have real-time requirements– Probably requires low manufacturing cost– Often has low power as requirement– Might have environment requirements
• Designed with tight deadlines by small teams– Acceptable is good enough
9
www.ntnu.no TDT4258
Functional complexity
• Functional complexity can be high for some devices
• Sophisticated algorithms– Laser printer– Cell phone
• Sophisticated user interfaces– Multitouch GPS
10
www.ntnu.no TDT4258
Real-time requirements
• Must finish operations by deadlines– Hard real-time: Missing deadlines causes failures– Soft real-time: Missing deadlines degrades performance
• Some systems are multi-rate– Different operations with different rates
• Video playback: Audio has different requirements from video
11
www.ntnu.no TDT4258
Non-functional requirements
• Mass-marked items– Low manufacturing cost is essential– Limits memory, processing power, ...– Must achieve requirements at minimum cost
• Reduce power consumption– Essential for battery powered application– Reduces operating cost even in wall powered devices– Reduces temperature -> increases life time
• Work in extreme environment– Satellites– Deep sea
12
www.ntnu.no TDT4258
Embedding computers
CPU
mem
input
output analog
analog
embeddedcomputer
13
www.ntnu.no TDT4258
Processing units
• Processing units– CPU – general purpose computing
• 8 bit, 16 bit, 32 bit
– GPU – graphics ++– DSP – signal processing
• Typically integrated into a single chip, together with I/O-devices, memory, ...– Microcontroller (small, cheap)– System-On-Chip (powerful, expensive)
CPU
mem
input
output analog
analog
embeddedcomputer
14
www.ntnu.no TDT4258
Custom logic vs. microprocessors• Custom logic: FPGA, ASIC
– Custom made logic, either in ASIC or FPGA– Hard to design (expensive)– Potential for creating more optimal solution
• Microprocessors– General, “easy” to write software– Simplifies the design– Simplifies the design of product families
• Can use SW to differentiate product
15
www.ntnu.no TDT4258
The performance paradox
• Would think custom logic always wins:– Microprocessors use much more logic (silicon area) than custom
logic (for small systems)– Microprocessors are (mostly) sequential, while custom logic often
exploits parallelism much more
• Not true, microprocessor can often be as fast or faster:– Large design teams
• Complex, deep pipelines
– Aggressive VLSI technology• Too expensive for all but the highest volumes
16
www.ntnu.no TDT4258
Power and energy
• Custom logic might beat processors for low power devices
• But CPUs have SW and HW techniques to reduce power consumption
• Only extreme power requirements results in implementing custom logic
17
www.ntnu.no TDT4258
Energy micro EFM32
18
www.ntnu.no TDT4258
Lecture overview
• Introduction
• Characteristics of embedded computers
• Embedded system design
• Design process examples
19
www.ntnu.no TDT4258
Challenges in embedded system design• How to meet performance requirements
– Improve HW: CPU, memory, busses, clock, ...– Improve SW: More clever algorithms, optimizations
• How to minimize power?– Turn off unnecessary logic? Change SW algorithms?
• How to meet deadlines?– Increase component cost or development cost?
20
www.ntnu.no TDT4258
HW/SW codesign
• You are designing a complete system
• Where to put functionality, HW or SW?
• The physics of software– Computers are physical machines– Embedded SW designers need to understand this
• Energy consumption• Performance
21
www.ntnu.no TDT4258
Design process
requirements
specification
architecture
componentdesign
systemintegration
22
www.ntnu.no TDT4258
Top-down or bottom-up
• Top down:– Start from high level, abstract description– Work towards more details
• Bottom-up:– Work from small components to big system
• A real design team uses both
23
www.ntnu.no TDT4258
Architecture design
• How to choose which components are needed, how to divide tasks between HW and SW?
• Ideal– Draw toplevel, functional diagram– Use spec to decide which HW modules are needed for the various
functions• Good enough performance• Low enough power consumption• Cheap
– Design communication busses to support spec
24
www.ntnu.no TDT4258
How it is typically done
• Find development board which can do what you need
• HW design group uses this as reference, removes unneeded components and creates HW design
• SW design group uses the board for SW development while waiting for HW prototype
25
www.ntnu.no TDT4258
Development boards
• Very common and useful tool for developing embedded systems
26
www.ntnu.no TDT4258
Challenges with developing and testing• Emulators, development boards, prototype boards
– Reduces observability and controllability
• Complex test situation, many interactive components, timing is critical for behaviour
27
www.ntnu.no TDT4258
Lecture overview
• Introduction
• Characteristics of embedded computers
• Embedded system design
• Design process examples
28
www.ntnu.no TDT4258
Design example: GPS
• A GPS device for car use
• Moving map
• Location from GPS
• Map from local storage
29
www.ntnu.no TDT4258
GPS: Requirements
• Show major roads and landmarks• Output: 600x400 screen• Input: Three buttons, popup menu
• Performance: Smooth map scrolling, 1s power up time, find position within 15s
• Cost: $500 street price
• Size: Fit dashboard• Power consumption: Comparable to
CD-player• Function in -10ºC, storage -30ºC
requirements
specification
architecture
componentdesign
systemintegration
30
www.ntnu.no TDT4258
GPS: Specification
• More detailed than the requirements
• Unambigous
• Understandable
• All top level functionality and characteristics specified– Map data– GPS data
– User interface– ...
requirements
specification
architecture
componentdesign
systemintegration
31
www.ntnu.no TDT4258
GPS: Architecture design
• Identify major components– HW and SW– Use off-the-shelf when possible
requirements
specification
architecture
componentdesign
systemintegration
32
www.ntnu.no TDT4258
GPS: Architecture design
GPSreceiver
searchengine
renderer
userinterface
DB
display
33
www.ntnu.no TDT4258
GPS: Architecture design
• Important high level choices– HW: CPU architecture, necessary I/O-devices, necessary HW
accelerators (DSP, GPU, FPGA, ASIC, ...)– SW: Operating system, programming language
• Find a commercial development board that mostly fits– STK1000
– RS232 GPS module
• Use devboard as reference for more detailed architecture
GPSreceiver
CPU
panel I/O
framebuffer
memory
display
34
www.ntnu.no TDT4258
GPS: Software development
position databasesearch
renderer
timeruser
interface
pixels
35
www.ntnu.no TDT4258
GPS: Software development
• Start developing for chosen devboard
• Use existing code when possible– OS– Map DB and SW
• Usually, most of the system can be finished before the HW prototype is done
• If HW prototype is delayed: Implement the rest of the system without HW– Simulate missing HW functionality
requirements
specification
architecture
componentdesign
systemintegration
36
www.ntnu.no TDT4258
GPS: System integration
• Move SW over to HW prototype– Many bugs appear at this stage
• Test, debug, maybe redesign
Test as much functionality as early as possible (using devboard, emulators, test code, dummy modules, ...)
requirements
specification
architecture
componentdesign
systemintegration
37
www.ntnu.no TDT4258
UML example: Model train controller
38
www.ntnu.no TDT4258
Digital Command Control (DCC)
• Standard for model train control
• Created by National Model Railroad Association
ECCaddressheader command
1 0
Time
39
www.ntnu.no TDT4258
Requirements
• Console:– Control 8 trains on 1 track– Throttle with 63 levels– Inertia control (8 levels)– Emergency stop button
• Communication– Error detection scheme on messages
40
www.ntnu.no TDT4258
Typical sequence
:console :train_rcvrset-inertiaset-speed
set-speed
set-speed
estop
41
www.ntnu.no TDT4258
Message classes
command
set-inertia
value: unsigned-integer
set-speed
value: integer
estop
42
www.ntnu.no TDT4258
Console system
console
panel formatter transmitter
receiver* sender*
1
1
1
111
11
11
43
www.ntnu.no TDT4258
Train system
train set
train
receiver
controller
motorinterface
detector* pulser*
11..t
1
1
11
1 1
1
1
11
44
www.ntnu.no TDT4258
Control input sequence diagram
:knobs :panel :formatter :transmitter
change in spee d/inertia/e stop
change intrain nu m
ber
change incontrolsettings
read panel
panel settings
panel-active
send-command
send-speed,send-inertia.send-estop
read panel
panel settings
read panel
panel settingschange intrainnumber
set-knobs
new-settings
45
www.ntnu.no TDT4258
Next lecture
• Processor instruction sets– Assembly programming