Post on 27-May-2020
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 1
Embedded SystemsT-106.5300
(5cr.), Spring 2008Olli Seppälä, Jaakko Ala-Paavola
January 24, 2008
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 2
What is an embedded system?
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 3
A matter of resources
200GB vs 32KB2GB vs 2KB
3GHz vs 4MHz100W vs 100mW
s vs ms vs µs
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 4
A fitness test on your wrist?
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 5
The structure of the ANN in the Polar Fitness Test™
Pers
onal
dat
a Polar OwnIndex™H
R a
nd H
RV Predicted VO2max
InputHidden layer
- nonlinear operation- linear operation
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 6
A fitness test on your wrist?
• 8-bit microprocessor• neural network• other software
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 7
Now
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 8
Course Basics 1/2Objective: To learn to design and to implement software for embedded systems given some hardware interfaces. The course discusses the implementation techniques of embedded systems, hardware issues, system testing and verification, fault tolerance and different paradigms for specification and design.
•Prerequisites: – T-106.3100 - Intermediate Course in Programming T2 (the C language) (5 cr)/
or T-106.3101 - Intermediate Course in Programming T2 (6 cr) or T-106.237 - Intermediate Course in Programming 2 (3 cr)or AS-0.1101/AS-0.101 or some other course on programming with C
– T-106.4150 - Operating Systems and Concurrent Programming (5 cr)T-106.4155 - Operating Systems (5 cr)T-106.430 - Operating Systems (3 ocr)
•Recommended courses:– T-106.4100/T-106.410 Design and Analysis of Algorithms– T-61.123 Computer Architecture– T-61.124 Computer Architecture Assignment Work– S-88.110 (digital systems)
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 9
Course Basics 2/2• To pass the course: Examination, possible homeworks and an
exercise project (developing the control software for a computercontrolled car) in a group of 3 persons. Hardware gurus can ask the lecturer about custom projects.
• Lectures: Thursdays 14-16 in lecture hall T1
• Instructors:olli.seppala @ tkk.fi, gsm 050 531 2311 (email and sms preferred)jap @ iki.fi
• Home page:http://wiki.tkk.fi/display/EmbeddedSystemshttp://www.cs.hut.fi/Studies/T-106.5300/2007/
• Discussion forum: opinnot.tik.sulautetut
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 10
Two lecturers, two tracks
• Theory and Applications (Seppälä)– Background– Theory– Examples
• Hardware and programming (Ala-Paavola)– Programming– Project details
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 11
Grading• The grade of the course is calculated with the following
formula: grade = min(5, ((exam + (pre-project + project)*scaling)) + race bonus)
where the grades of the individual parts of the course are: • exam 0-5 • projects 0-5 (pre-project 20 points, car project 100 points,
scaled on a gaussian)
The car race can raise you two grade points for a win, one point for places 2-4.
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 12
Excercise Project• Write code to control the
car on an indoor track.• More details in later
lectures• The given hardware for
the car project is used to give an idea of the consideration needed in selecting hardware for a new project
• Examples: slow car, fast car
Examples:Fast Slow
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 13
The AVR microcontroller
Source: Atmel Datasheet http://www.atmel.com/dyn/resources/prod_documents/2503S.pdf
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 14
Course materials and books
• Lecture notes will be available on the course web page
• There are no required books– but there are many good books
• Internet links will be provided– www.embedded.com
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 15
Main Subjects• Introduction• The car
– project info– technical details
• Computer architecture• Kernels• Peripheral devices• Complex peripherals• Control systems• Measurement and Calibration• Reliability vs. Fault Tolerance• THERAC-25
• System Reliability• Mechanisms for Robustness• Mechanisms for Fault
Tolerance• Hardware oriented
programming• Memory management• The Scheduler• Real Time• Distributed systems• Parallel Programming• Advanced hardware• Exam review
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 16
Objectives of this course
• Embedded frame of mind• Experience in programming a successful
embedded system
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 17
Development• Background
– What is required– What is available
• Designer’s task– Can it be done?– How?
• Success comes from working around the limitations to get the job done
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 18
Common Features of Embedded Design
• Combine hardware and software verytightly (almost inseparably)
• Implemented with limited resources• Real constraints and requirements
– real time– fault tolerance– operating environment
• Embedded systems are often invisible
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 19
Interdisciplinary knowledge• Hardware
– bits and bytes vs waves– computers are precise but inaccurate
• Electronics– interfaces– signal levels
• Specific applications• Legal• Business• Engineering knowledge
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 20
Specifying Embedded Systems1/2
• Expertise from different fields is needed– software– hardware– mechanics and control– the specific application
• Who leads the group?• Cooperation and overlap is vital
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 21
Specifying Embedded Systems2/2
The goal of the specification is to define the:– Functionality of the system– Interfaces of the software and hardware
• modules• fields
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 22
System Co-Design
Is a systematic, parallel and combineddesign process of both the hardware and the software where the interfaces aredefined as the design work progresses
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 23
Modular DesignSystem specification
System design
Partitioning into modules
Integration and testing
Software specification
Software design
Software implementation
Software testing
Hardware specification
Hardware design
Hardware implementation
Hardware testing
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 24
Example: Ship Autopilot Control• Combining a navigation system
to a ship autopilot• Expertise needed in the fields of:
– Naval Engineering– Control Systems– Navigation– Hardware– Software– Maritime rules and legislation
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 25
Ship Autopilot Control
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 26
User’s Viewpoint
• One of the many tools used to get the shipfrom one place to another
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 27
Navigation Expert viewpoint• Application field – defines functional
requirements• Knows the technology and available
interfaces (sensors, controls)• Understands the behavior of the systems
well• Sees the system as a Navigation system
with additional features
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 28
Automation Expert Viewpoint
• Extends the knowledge of the Navigationexpert on automation and controltechnology
• Makes available new methods and technologies into the task
• Sees the system mainly as a controlproblem
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 29
Control System Algorithms
Source: Modern Control Engineering by Ogata, p. 606
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 30
Hardware Expert Viewpoint• Responsible for the equipment which will
operate the Navigation system• Works with the Automation expert to
properly interface and connect to devices• May need to consult other experts• Sees the task as a hardware problem and
the software as a black box
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 31
Software Expert Viewpoint• Software is the glue and
the magic of the system• SW expert often controls the
complete design• Designs, implements, and tests the
software with other experts• Sees the hardware as a black box and
seeks to solve the Navigation and Automation issues with software
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 32
Ship Autopilot Control
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 33
Hardware and Software • Typically, there is a choice of
implementing a feature in HW or SW– many deciding factors:
• the application and the details• cost• safety• legal requirements
• Programmable Hardware• Interfaces
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 34
Why care about hardware?
• Embedded systems do not typicallyprovide the luxury of hardware abstractionlayers
• The developer often writes any necessarydrivers
• Using available hardware functions canmake all the difference
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 35
DES/3DES En/Decryption• A complex algorithm in a
25MHz AVR microcontroller withFPGA at 4.2 MByte/Secthroughput
http://www.atmel.com/journal/documents/issue4/pg29_30_des3des.pdf
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 36
Apollo Guidance Computer (1969)• Instruction Set: Approximately 20
instructions; 100 noun-verb pairs, data up to triple-precision Word Length: 16 bits (14 bits + sign + parity)
• Memory: ROM (rope core) 36K words; RAM (core) 2K words
• Disk: None• I/O: DSKY (two per spacecraft)• Performance: approx. Add time - 20 s• Basic machine cycle: 2.048 MHz• Technology: RTL bipolar logic (flat pack)• Size: AGC - 24" x 12.5" x 6" (HWD);
DSKY - 8" x 8" x 7" (HWD)• Weight: AGC - 70 lbs; DSKY - 17.5 lbs• Number produced: AGC - 75; DSKY: 138• Cost: Unknown.• Power consumption: Operating: 70W @
28VDC; Standby 15.0 wattsSource: http://www.ddj.com/documents/s=1494/ddj0006hc/
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 37
Mars Rovers: Sojourner (1997)• CPU: 80C85 rated at
100Kips (0.1 MIPS)• Memory: 176KB PROM,
576KB RAM, in 16Kbyte pages
• I/O: ~70 sensor channels and services such devices as the cameras, modem, motors and experiment electronics.
• Controlled via landerSource: http://mars.sgi.com/MPF/rover/sojourner.html
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 38
Mars Lander: Pathfinder (1997)• CPU: Radiation Hardened IBM RISC 6000 Single Chip (Rad6000 SC) • Memory: 128 MB DRAM• Clock: 2.5, 5, 10 and 20 MHz. This translates to approximately 2.7, 5.5, 11,
and 22 MIPS• Code: The code was developed using VxWorks as the real-time OS and
"C" and assembly languages. It utilizes object-oriented constructs.• On the system there is only one
computer to control the spacecraft throughout all phases of the mission. The Rover has a very small CPU that it uses once we have landed and the rover is released. All communications to Earth from the spacecraft and rover come through the Rad6000 SC.
Source: http://mars.sgi.com/MPF/mpf/faqs_general.html#mhzImage from: http://mars.jpl.nasa.gov/MPF/mpf/slides/slides-16.html
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 39
Mars Rover: Spirit (2004)• CPU: Radiation Hardened IBM
RISC 6000 Single Chip (Rad6000 SC)
• Memory: 128 MB ECC DRAM, 3MB EEPROM
• Clock: 2.5, 5, 10 and 20 MHz. This translates to approximately 2.7, 5.5, 11, and 22 MIPS
• Code: The code was developed using VxWorks as the real-time OS and "C" and assembly languages. It utilizes object-oriented constructs.
Source: http://www.gcn.com/22_24/news/23246-1.htmlhttp://europe.windriver.com/literature/successstories/WindRiver_customer_story_mars_rover_engl.pdfhttp://www.computerworld.com/governmenttopics/government/story/0,10801,88734,00.html
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 40
Engineering Ethics
For a business, cost and necessary profitare important. But an engineer shares the responsibility of designing safe and reliablesystems, regardless of possible pressuresand influence to do it faster, cheaper, now! Every organization is made up of individuals, each responsible for their ownactions.
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 41
Therac-25
Source: http://www.uoguelph.ca/~tgallagh/
TEKNILLINEN KORKEAKOULUHELSINKI UNIVERSITY OF TECHNOLOGY
olli.seppala @ tkk.fi 42
Suggested Reading• http://sunnyday.mit.edu/therac-25.html
Definitive story of the Therac-25 case
• http://www.ddj.com/documents/s=1494/ddj0006hc/One Giant Leap The Apollo Guidance ComputerSource: Dr. Dobbs Journal (http//www.ddj.com)
• http://www.ddj.com/documents/s=1493/ddj0001hc/Dr. Strangelove Meets IBM: The SAGE SystemOne of the first air-defense computer systems
• http://www.embedded.com/2000/0011/0011br.htmCrash And Burn embedded system disastersSource: Embedded Systems Programming ( http://www.embedded.com/ )
• http://www.fastcompany.com/online/06/writestuff.htmlThey Write the Right Stuff – the story of the space shuttle control softwareSource: Fastcompany
Links tested current on 1.2.2006 OSe