Embedded Real-Time Systems Reinhard von Hanxleden Christian-Albrechts-Universität zu Kiel Based on slides kindly provided by Edward A. Lee & Sanjit Seshia, UC Berkeley, All rights reserved Lecture 1: Introduction
Welcome to this course! Lectures: Prof. Reinhard von Hanxleden rvh@informatik.uni-kiel.de Office: 1118, highriser Office hours after class, or daily 9:30am in R1114 Recitals (Übungen) Steven Smyth, ssm@... Merlin Steven Smyth, stu115775@... Lecture 1: Introduction, Slide 2
Class Materials The reference text book (Skript): Lee & Seshia (UC Berkeley), Introduction to Embedded Systems A Cyberphysical Approach, MIT Press, ISBN 978-0-262-53381-2, 2017 Available on-line: http://leeseshia.org/ Lecture slides are available at class home page: https://ilearn.ps.informatik.uni-kiel.de/public/courses/130 Lectures numbered according to text book chapters (1st ed.) Lecture 1: Introduction, Slide 3
Your Grade Assignments Can receive bonus points for outstanding solutions Can reject or deduct points for late submissions or anything else that makes the graders life more miserable than necessary Your grade is given by final written exam + homework assignments Tentatively: Fri, 9 February 2018, 10:00 12:00 (Digital Communications MsC students: please contact me for arranging exam date) Need at least 50% in final exam to pass Grade = max (final exam, 85% final exam + 15% homeworks) In borderline cases, also consider participation in class Allowed to take final exam if: Received at least 50% of homework assignment points Lecture 1: Introduction, Slide 4
Course Outline 1 Introduction I Modeling Dynamic Behaviors 2 Continuous Dynamics 3 Discrete Dynamics 4 Hybrid Systems 5 Composition of State Machines 6 Concurrent Models of Computation II Design of Embedded Systems 7 Embedded Processors 8 Memory Architectures 9 Input and Output 10 Multitasking 11 Scheduling III Analysis and Verification 12 Invariants and Temporal Logic 13 Equivalence and Refinement 14 Reachability Analysis and Model Checking 15 Quantitative Analysis Lecture 1: Introduction, Slide 5
Practical Exercises KIELER Ptolemy (UC Berkeley) Lego Mindstorms NXT Lecture 1: Introduction, Slide 6
What are Embedded Systems? Computers whose job is not primarily information processing, but rather is interacting with physical processes. Examples: Automotive controllers Avionics Medical devices Industrial control Energy management and conservation A broader view is that of cyber-physical systems (CPS) Lecture 1: Introduction, Slide 7
What are Embedded Systems? Computational systems l but not first-and-foremost a computer Integral with physical processes l sensors, actuators, physical dynamics Reactive l at the speed of the environment (timing matters!) Heterogeneous l hardware/software/networks, mixed architectures Networked l concurrent, distributed, dynamic Lecture 1: Introduction, Slide 8
2001 National Research Council Report Embedded Everywhere Information technology (IT) is on the verge of another revolution. Driven by the increasing capabilities and ever declining costs of computing and communications devices, IT is being embedded into a growing range of physical devices linked together through networks and will become ever more pervasive as the component technologies become smaller, faster, and cheaper... These networked systems of embedded computers... have the potential to change radically the way people interact with their environment by linking together a range of devices and sensors that will allow information to be collected, shared, and processed in unprecedented ways.... The use of [these embedded computers] throughout society could well dwarf previous milestones in the information revolution. Lecture 1: Introduction, Slide 9
Cyber-Physical Systems (CPS): Orchestrating networked computational resources with physical systems Automotive Building Systems Avionics Telecommunications Transportation (Air traffic control at SFO) E-Corner, Siemens Power generation and distribution Factory automation Instrumentation (Soleil Synchrotron) Daimler-Chrysler Military systems: Courtesy of Doug Schmidt Courtesy of General Electric Courtesy of Kuka Lecture Robotics Corp. 1: Introduction, Slide 10
Example: Medical Devices Emerging direction: Cell phone based medical devices for affordable healthcare e.g. Telemicroscopy project at Berkeley e.g. Cell-phone based blood testing device developed at UCLA Lecture 1: Introduction, Slide 11
CPS Example Printing Press Bosch-Rexroth High-speed, high precision Speed: 1 inch/ms Precision: 0.01 inch -> Time accuracy: 10us Open standards (Ethernet) Synchronous, Time-Triggered IEEE 1588 time-sync protocol Application aspects local (control) distributed (coordination) global (modes) Lecture 1: Introduction, Slide 12
Example: Automotive electronics today About 80 computers (electronic control units, ECUs) in a premium car today: l engine control, transmission, anti-lock brakes, electronic suspension, parking assistance, climate control, audio system, body electronics (seat belt, etc.), display and instrument panel, autonomous driving, etc. l linked together by CAN bus, FlexRay, etc. with up to 2km of wiring. l growing fraction of development costs, manufacturing costs, and fuel consumption. Lecture 1: Introduction, Slide 13
Where CPS Differs from the traditional embedded systems problem: The traditional embedded systems problem: Embedded software is software on small computers. The technical problem is one of optimization (coping with limited resources and extracting performance). The CPS problem: Computation and networking integrated with physical processes. The technical problem is managing dynamics, time, and concurrency in networked computational + physical systems. Lecture 1: Introduction, Slide 14
A Key Challenge on the Cyber Side: Real-Time Software Correct execution of a program in C, C#, Java, Haskell, etc. has nothing to do with how long it takes to do anything. Lecture 1: Introduction, Slide 15
Techniques Exploiting the Fact that Time is Irrelevant Programming languages Virtual memory Caches Dynamic dispatch Speculative execution Power management (voltage scaling) Memory management (garbage collection) Just-in-time (JIT) compilation Multitasking (threads and processes) Component technologies (OO design) Networking (TCP) Lecture 1: Introduction, Slide 16
Content of an Embedded Systems Course Traditional focus Hardware interfacing Interrupts Memory systems C programming Assembly language FPGA design RTOS design CPS focus Modeling Timing Dynamics Imperative logic Concurrency Verification Lecture 1: Introduction, Slide 17
A Theme in our course: Model-based design Models are abstractions of systems: structural (OO design) ontological (type systems) imperative logic functional logic actor-oriented (including dataflow models) All of these have their place Lecture 1: Introduction, Slide 18
CPS is Multidisciplinary Computer Science: Carefully abstracts the physical world System Theory: Deals directly with physical quantities Cyber Physical Systems: Computational + Physical Lecture 1: Introduction, Slide 19
First Challenge Models for the physical world and for computation diverge. l physical: time continuum, ODEs, dynamics l computational: a procedural epistemology, logic Lecture 1: Introduction, Slide 20
Second Challenge We typically learn to use modeling techniques, not to evaluate modeling techniques. l this is how computers work l this equation describes that feedback circuit rather than l this is how Von Neumann proposed that we control automatic machines l ignoring the intrinsic randomness and latency in this circuit, Black proposed that we could idealize its behavior in this way Lecture 1: Introduction, Slide 21
What this course is about A principled, scientific approach to designing and implementing embedded systems Not just hacking!! Hacking can be fun, but it can also be very painful when things go wrong Focus on model-based system design, and on embedded software Lecture 1: Introduction, Slide 22
Traditionally, embedded systems has been an industrial (not academic) problem, principally about resource limitations. small memory small data word sizes relatively slow clocks When these are the key problems, emphasize efficiency: write software at a low level (in assembly code or C) avoid operating systems with a rich suite of services develop specialized computer architectures: l programmable DSPs l network processors develop specialized networks l Can, FlexRay, TTP/C, MOST, etc. This is how embedded SW has been designed for 30 years Lecture 1: Introduction, Slide 23
But embedded systems do have more fundamental differences from general-purpose computation: time matters l as fast as possible is not good enough concurrency is intrinsic l it s not an illusion (as in time sharing), and l it s not (necessarily) about exploiting parallelism processor requirements can be specialized l predictable, repeatable timing l support for common operations (e.g. FIR filters) l need for specialized data types (fixed point, bit vectors) programs need to run (essentially) forever l memory usage has to be bounded (no leaks!!) l rebooting is not acceptable Lecture 1: Introduction, Slide 24
What about real time? Make it faster! What if you need absolutely positively on time? Today, most embedded software engineers write code, build your system, and test for timing. Model-based design seeks to specify dynamic behavior (including timing) and compile implementations that meet the behavior. Lecture 1: Introduction, Slide 25
Real-Time Multitasking? Prioritize and Pray! Lecture 1: Introduction, Slide 26
An engineer s responsibility Korean Air 747 in Guam, 200 deaths (1997) 30,000 deaths and 600,000 injuries from medical devices (1985-2005) l perhaps 8% due to software? source: D. Jackson, M. Thomas, L. I. Millett, and the Committee on Certifiably Dependable Software Systems, "Software for Dependable Systems: Sufficient Evidence?," National Academies Press, May 9, 2007. Lecture 1: Introduction, Slide 27
A Story A fly by wire aircraft, expected to be made for 50 years, requires a 50-year stockpile of the hardware components that execute the software. All must be made from the same mask set on the same production line. Even a slight change or improvement might affect timing and require the software to be re-certified. Lecture 1: Introduction, Slide 28
Abstraction Layers The purpose for an abstraction is to hide details of the implementation below and provide a platform for design from above. Lecture 1: Introduction, Slide 29
Abstraction Layers Every abstraction layer has failed for time-sensitive applications. Lecture 1: Introduction, Slide 30
Is the problem intrinsic in the technology? Electronics technology delivers highly repeatable and precise timing 20.000 MHz (± 100 ppm) and the overlaying software abstractions discard it. Lecture 1: Introduction, Slide 31
Some CPS applications: telepresence distributed physical games traffic control and safety financial networks medical devices and systems assisted living advanced automotive systems, energy conservation environmental control aviation systems critical infrastructure (power, water) distributed robotics military systems smart structures biosystems (morphogenesis, ) Potential impact social networking and games safe/efficient transportation fair financial networks integrated medical systems distributed micro power generation military dominance economic dominance disaster recovery energy efficient buildings alternative energy pervasive adaptive communications distributed service delivery Lecture 1: Introduction, Slide 32
Topics we will study Model-Based Design l Implementation code based on a mathematical model System Analysis l Verify that your model & implementation will meet a spec Concurrency l Run multiple tasks correctly and efficiently Time & Resources l Ensuring that tasks finish on time and within budgets Networking and other Advanced Topics l Automotive networks, mapping an area by a robot, etc. Lecture 1: Introduction, Slide 33
Summary Embedded Systems: Computers whose job is not primarily information processing, but rather is interacting with physical processes Cyber-Physical Systems: Computation and networking integrated with physical processes Key challenge: Real-time software A theme of this course: model-based design Challenges in modeling: 1. Models for the physical world and for computation diverge 2. We typically learn to use modeling techniques, not to evaluate modeling techniques Lecture 1: Introduction, Slide 34