Embedded Systems
(AI and Embedded Systems?)
Kavi Arya
CSE Dept.
IIT-Bombay
Plan
• Embedded Systems I ntro + examples
- ERTS Lab Microcontroller workshop
• Formal Approaches to building ESW
– Modeling languages
• New language paradigms
– Esterel, Handel-C, AHIR, …
• AI and Embedded Systems
– AI finally coming of age
• Project E-Yantra
Microcontroller Workshop
• Dates:
– Periodic
• Introduction to the Firebird robot
– Introduction to AVR Atmega 128 microcontroller – I/O control
– Velocity control using PWM
– Interrupt programming: Closed loop posn control of robot using position encoders
– LCD interfacing
– Serial communication
• Applications:
– White line following
– Adaptive Cruise Control application
• from computers to embedded and networked SoCs
• complete change in device interaction
• growing number of critical applications
Beware of the computer!
The most difficult real-time manoeuver ever
Here should be a fabulous drawing of Hergé’s
"Explorers on the Moon".
Drunk Captain Haddock has become a satellite of the Adonis asteroid. To catch him, Tintin, courageously standing on the rocket's side,
asked Pr. Calculus to start the rocket's atomic engine.
At precisely the right time, he shouts "STOP"!
This is the trickiest real-time manoeuver ever
performed by man. It required a perfect understanding of Newtonian Mechanics and absolute synchrony.
The most difficult real-time manoeuver ever
Computing
without Computers
(or, the changing nature of computers
or, where/what is hardware?)
Computing without Computers*
• Changes in how we design and deliver computing power
– Reconfigurable computing and custom computing
– i.e. turn sw into hw - everything speeds up - no computer to slow us
• Computer features
– Seq one-step-at-a-time, machines - their strength and their weakness.
– Strength because flexible, standard products
– Easy to program and deliver a wide range of applications cheaply
• Today’s computers surrounded by other chips
– graphics processing, display handling, network interfacing, sound generation, wireless comm., etc.
– Computer could in principle handle by itself - if it were fast enough.
– We are used to having computers run applications software, – Supported by a range of functions embedded in hardware.
*Prof. Ian Page, University of Oxford, 1990’s
Changes Happening
• New ways of designing/delivering computer capability
– PCs, mobile phones, etc.
• Changing structure of electronics & computing industry
– Largest manufacturer of cameras?
• Changing products that people buy as well as the way that they buy and use them
– Tape-recorder -> Walkman -> digital players -> iPod -> … – Books -> ebooks -> …
– Mainframe -> minicomps -> PCs -> servers -> cloud
• Changing how money is made out of delivering electronic products to customers
– Products changing into services
– Potentially deep and far-ranging effects of sustainability
Technological & economic drivers of change
• Nature of silicon industry
• Extraordinary consequences of Moore’s Law.
• Focus moving away from ASIC (application
specific chip) technology towards standard chip products and thus lower prototype costs
• Big winner: reconfigurable hardware - in particular FPGA chips
• Can reduce the $6M development cost of a new
chip to a few dollars and a few days
Why do Things Have to Change?
• Sheer size of modern FPGAs
– Costly to design using traditional approaches based around conventional Electronic Design Automation (EDA) techn.
• Reasons for difficulty:
– Multi-million-gate sizes available – Shortage of electronic design skills
– Need design rapidly and reliably to mkt pressures
– Need for frequent rework to update hardware in service
• Situation no worse than designing other types of chips
– But FPGAs enable substantial reductions in the time to implement a new product.
• Need for similar reduction in time to design as well
Why do Things Have to Change?
• Pressure on productivity of design engineers working on complex systems.
• Time has come to design hardware using software engineering - rather than hw engg - methodologies.
• Complexity of system is the basic problem, and
Moore’s Law doubles complexity every 18 months.
• Advances in software engineering help produce complex systems with more easily available design skills, making large profits
• We expect new designers, with/without hardware
design skills, will design hardware in future
Present Reality
• Proliferation:
– > 30 times as many computers are used in embedded systems as in general-purpose personal computers.
• Design increasingly difficult – Design options are huge
• Communication
– Interaction between devices
– Uncertainty that must be modeled into a system
• Open Source
– “Sun opens Niagara chip design to world”by Ashlee Vance in Mountain View…
published Tuesday 6th December 2005
– Sun moved to "open source" the UltraSPARC T1's design – Source of design in Verilog
– Verification suite and simulation models, instruction set
architecture specification (UltraSPARC Architecture 2005) and a Solaris OS port" for the UltraSPARC T1.
– Other companies can create versions of the low-power chip to handle other software than the web and application server loads Sun has aimed at with its new servers.
• "You don't know where it's going to go,"
– Said Sun's CEO Scott McNealy, during a product launch event in New York. "That's the beauty of it."
Embedded System
Diversity
Diverse Applications and Constraints
Trajectory & attitude control, imaging, transmission,...
most often mission-critical => extra high quality
Phones, audio, TV, DVD, games, ...
time-to market and quality are business critical
Flight control, power, brakes, landing gear, displays,...
most often safety-critical => certification
Pacemakers, glucosis control, robot surgeons,...
life-critical => ???
Embedded Systems
• Single functional in early days (not now!)
– e.g. pager, mobile phone
• Tightly constrained
– cost, size, performance, power, etc.
• Reactive & real-time
– e.g. car’s cruise controller
=. delay in computation => failure of system
Software Engineering…
Why we need it?
Common Design Metrics
• NRE (Non-recurring engineering) cost
• Unit cost
• Size (bytes, gates)
• Performance (execution time)
• Power (more power=> more heat & less battery time)
• Flexibility (ability to change functionality)
• Time to prototype
• Time to market
• Maintainability
• Correctness
• Safety (probability that system won’t cause harm)
Why Is Embedded Software Not Just Software On Small Computers?
• Embedded = Dedicated
• Interaction with physical processes – sensors, actuators, processes
• Critical properties are not all functional
– real-time, fault recovery, power, security, robustness
• Heterogeneity
– hardware/software tradeoffs, mixed architectures
• Concurrency
– interaction with multiple processes
• Reactivity
– operating at the speed of the environment
These features look more like hardware!These features look more like hardware!
What is Embedded SW?
• What is it
not
?• Application software can be recompiled and executed on any number of hardware platforms so long as the basic services/libraries are provided.
– It is divided by vertical market segments (application domains)
– Well-established methodologies, architectures,…
– HW platform independent, highly portable
• Any SW that has no direct relationship with HW.
Current Technology
Extrapolation of traditional software techniques
• Programs written in conventional languages
C subsets, MISRA C for automobile Java for telephone / smartcards
• Glued together by OS services
A wide variety of embedded OS (VxWorks, OSEK)
• With some reuse and standardisation effort
•
Classical software models largely inadequate
•Too powerful, hard to verify
•often subsets of rich languages=>doesn’t make them simpler
Current Bottleneck
• Intrinsic application complexity grows rapidly
analog / digital interface: more objects to control
embedded algorithmics: signal, display, alarm, power...
richer hardware architecture: P, DSP, ASIP, ASIC, FPGA
• Performance adds complexity
footprint / power minimization interferes with logical design technology independence is still difficult
=> Verification bottleneck
applications hard to verify off- site
hardware / software interaction difficult
• Therac 25 : lethal irradiations
• Dharan's Patriot
• Ariane V
• Mars Explorer, Mars Polar Lander
• High-end automobile problems
• Pentium, SMP cpu networks
• Telephone and camera bugs
Bugs grow faster than Moore's law!
Enemy number 1 : the bug
Other Important Issues
• Hardware / software partitioning
hardware / software source code independence
link between programming and performance analysis
• Operating Systems / scheduling
well-studied field: rate-monotonic, earliest deadline first, etc.
newer computation models need less explicit scheduling
• Fault tolerance
software redundancy, voting algorithms, etc.
CRCs, TT networks
How to avoid or control bugs?
•
Traditional : better verification by fancier simulation
• Next step : better design using specific techniques
better and more reusable specifications
simpler computation models, formalisms, semantics
reduce architect / designer and customer / provider distance reduce hardware / software distance
•
Requires better tooling
higher- level models and synthesis
formal property verification / program equivalence certified libraries
Anatomy of Embedded Applications
• CC : continuous control, signal processing
differential equation solving, filters
specs and simulation in Matlab / Scilab, manual or automatic code
• FSM : finite state machines, state transition systems
discrete control, protocols, networking, drivers, security, etc.
flat or hierarchical state machines, manual or automatic code
• Calc : calculation intensive
navigation, security, etc.
C, manual + libraries
• Web : web-like navigation, audio / video streaming
consumer electronics, infotainment systems data-flow networks, embedded Java
Global Coordination
ABS Engine control
Light control
Supension Gearbox
Clutch
Airbags
Direction
Anticollision Alarm detection Automatic
toll
GPS
ABS
Panel Engine control
Infotainment
Light control
Supension Gearbox
Clutch
Airbags
Direction
Climate
Sleep detector Alarm detection Automatic
toll
GPS
Seat adjust
Embedded Systems in
Automobiles
Global Coordination ???
CC+FSM CC+FSM+Calc
FSM
CC CC+FSM
CC+FSM
CC+FSM
CC
CC+FSM+Calc CC+FSM
FSM
Calc+FSM CC+FSM
Web + Calc +FSM
CC+FSM
CC+FSM
FSM
Design Issues
(or, how do we build these systems?)
Functional Design & Mapping
HW1 HW2 HW3 HW4
Hardware Interface RTOS/Drivers
Thread
Architectural Design
F1 F2
F3
F4
F5
Functional Design
(F3) (F4)
(F5)
(F2)
Source:
Ian Phillips, ARM
VSIA 2001
Source:
Source:
Ian Phillips, ARM Ian Phillips, ARM
VSIA 2001
Trends
• Moore’s Law
– IC transistor capacity doubles every 18 mths – 1981: leading edge chip had 10k transistors – 2002: leading edge chip has 150M transistors
– 2010: Leading edge Intel processor has 0.5B trans in 107sq.mm – Why? reducing trans size, increasing chip size, clever circuits – Changing due to paradigm shifts: sys design tools, nanotech, ...
• Designer productivity has improved due to better tools:
– Compilation/Synthesis tools – Libraries/IP
– Test/verification tools – Standards
– Languages and frameworks (Handel-C, Lava, Esterel, …) – 1981: designer produced 100 transistors per month
– 2002 designer produces 5000 transistors per month – 2010 designer produces ???
Reconfigurable Computing Lab --
Hardware Environment
ERTS Lab Spinoff:
Project E-Yantra
Robots for College Education
Rs. 90,000
IITB Robots (initial cost)
IITB Fire Bird 2A Rs.12,000
IITB Fire Bird 2B Rs.15,000
Robots available internationally
Rs.37,80,000
Rs.28,350
*ERTS Lab Robot Development
March 2005 July 2005 January 2006
September 2006 December 2006 January 2007
*Embedded & Real-Time Systems Lab, KReSIT, IIT-Bombay
Fire Bird Educational Robot
Designed by: ERTS LAB CSE IIT BOMBAY
Features:
• Incorporates 5 years experience teaching Embedded Systems at IIT-Bombay
• Low-cost (Rs.15k)
• Open source design
• Modular & versatile
• Excellent documentation
• Support through
(www.nex-robotics.com)
• Good for teaching/research
• Extensive software support
CS308 Embedded Systems + Robotics Lab
E
- Yantra
(http://www.e-yantra.com)
• Genesis:
– From our teaching experience of Embedded Sys.
• Goal:
– Design/ deploy Robots in Engg. Colleges – Conduct Workshops as part of Continuing
Education Program for faculty/ students
– Creation of Web based Educational resources – Low-cost robots (to build and maintain)
– Student projects (open source) for others to use
Work products
• Robots developed:
– Fire Bird V 8051 (for existing courses) – Fire Bird V AVR (current teaching usage)
– Fire Bird V ARM7 (Base platform for advanced/ research use)
• Key documentation developed:
– Fire Bird V 8051 software manual – Fire Bird V 8051 hardware manual
– Fire Bird V ATMEGA2560 software manual – Fire Bird V ATMEGA2560 Hardware manual
• Teaching material:
– Lecture slides, course notes, assignments, quizzes, etc.
– “How-to” set-up and administer a lab
– Lots of project video+code to be uploaded
• Sharing:
– E-Yantra Website http://www.e-yantra.com
• Demo:
– FBV-8051 with camera pod controlled by GUI over wireless link – FBV-AVR following white line (ACC)
Coming at your local engineering college…
MHRD’s E-Yantra: The Next Wave of Robotics
Conclusion
• We have simultaneous optimisations of competing design metrics: speed, size, power, complexity, etc.
• We need a “Renaissance Engineer”
– with holistic view of design process and comfortable with
technologies ranging from hardware, software to formal methods
• Maturation of system-building tools
– enables unified view of hardware/ software co-design.
• Design efforts now focus at higher levels of abstraction
=> abstract specifications refined into programs then into gates and logic.
• There is no fundamental difference of between what hardware and software can implement.