39245175 intro-es-ii

45
1 Embedded System Design NARINA THAKUR Bharti Vidyapeeth’s College of Engineering Dept of Computer Science

Transcript of 39245175 intro-es-ii

Page 1: 39245175 intro-es-ii

1

Embedded System Design

NARINA THAKUR

Bharti Vidyapeeth’s College of Engineering

Dept of Computer Science

Page 2: 39245175 intro-es-ii

2

Introduction•Definition of Computer system•Definition of Embedded system•How are embedded systems designed? (Hardware and Software)•Critical Design challenges

Page 3: 39245175 intro-es-ii

3

Definition of a Computer SystemA Computer is a system that has following

or more hardware Components:• A microprocessor• Large memory comprising (i) Primary Memory (ROM, RAM, Cache)(ii) Secondary memory (HDD, CDROM, FDD,

Cartridge tapes)• Input devices (KB, Mouse, Digitizer,

Scanner)• Output devices (Video Monitor, Printer)• Networking Card (Ethernet LAN)• I/O Units (Modem, Fax cum Modem)

Page 4: 39245175 intro-es-ii

4

Definitions of Embedded System

• An Embedded System has computer hardware with Software embedded in it as one of its most important components.

• Dedicated computer based system for a given application or product.

• It might be either an Independent System or

• Part of a larger System. • Software embeds in ROM. Does not need

any Secondary Memory.

Page 5: 39245175 intro-es-ii

5

Definitions Continued……….

• Todd D. Morton: Author - Embedded µC(s)

• Embedded Systems are electronic systems that contains a µP or µC. But, we do not think of them as computers.

• The computer is hidden or embedded in a system.

Page 6: 39245175 intro-es-ii

6

Definitions Continued……….

• Tim Wilmshrust: Author – An Introduction to design of small scale Embedded Systems.

• An Embedded System is a system whose principal function is not computational, But which is controlled by a computer embedded with-in it.

• The Computer is likely to be a µP or µC.

Page 7: 39245175 intro-es-ii

7

Definition of Embedded System (Continued)• An Embedded System is a µC based, • Software driven, Reliable, Real time

control system, • Autonomous or Human or Network

interactive, • Operating on diverse physical variables

and in diverse / hostile environments • Sold into a competitive & Cost conscious

market

Page 8: 39245175 intro-es-ii

8

Embedded World!

• Embedded processors account for 99% of world-wide microprocessor production !

• Embedded : desktop = 99 : 1

Page 9: 39245175 intro-es-ii

9

Embedded Systems• The embedded

system is completely enclosed in the main system.

• It does not interact directly with the environment.

• For example – a micro-computer in a car ignition control.

Page 10: 39245175 intro-es-ii

10

What is an Embedded System?

• Embedded systems are more limited in hardware and/or software functionality than a personal computer.

• An embedded system is designed to perform a dedicated function.

• An embedded system is a computer system with higher quality and reliability requirements than other types of computer systems.

Page 11: 39245175 intro-es-ii

11

A Real Embedded (Indeed)• Simple, not much overhead• Robust, reliable, ready• Protocol sensitive• Ubiquitous (Ever-present)• Acts within the system• Does not react directly with

environment• Works real time• Senses the sensors, processes

the input, actuates the actuators.

Page 12: 39245175 intro-es-ii

12

Embedded System?

• Computational

– but not first-and-foremost a computer

• Integral with physical processes

– sensors, actuators

• Reactive

– at the speed of the environment

• Heterogeneous

– hardware/software, mixed architectures

• Networked

– shared, adaptive

Page 13: 39245175 intro-es-ii

13

Embedded Systems: Common Situation

• Different hardware devices and architectures

• Increased complexity

• Non-standard tools and design processes

• Redundant development efforts

• Increased R&D and sustaining costs

• Lack of standardization results in greater quality risks

Page 14: 39245175 intro-es-ii

14

Embedded Systems and their Markets

Market Embedded Device

Automotive Ignition System, Engine Control, Brake System

Consumer Electronics

Digital and Analog Televisions, Set-Top Boxes, Kitchen Appliances, Toys/Games, Telephones/Cell Phones/Pagers, Cameras, GPS

Industrial Controls

Robotics and Manufacturing Controls

Medical Infusion Pumps, Dialysis Machines, Prosthetic Devices, Cardiac Monitors

Networking Routers, Hubs, Gateways

Office Automation

Fax Machine, Photocopier, Printers, Monitors, Scanners

Page 15: 39245175 intro-es-ii

15

Components of Embedded System

• It has Hardware• Main Application Software-may perform

concurrently the series of tasks or multiple tasks• Real Time Operating System (RTOS)

Supervises the Application Software,Provides a mechanism to let the processor run a process as per scheduling and do the context switch between the various processes (tasks).

Page 16: 39245175 intro-es-ii

16

Components of an Embedded System Hardware

Power Supply, Reset and Oscillator Circuits

System Application Specific Circuits

Inp

ut

Dev

ices

In

terf

acin

g /

Dri

ver

Cir

cuit

s

Ou

tpu

t In

terf

acin

g /

Dri

ver

Cir

cuit

s

Processor

Program Memory &

Data Memory

Timers

Interrupt Controller

Parallel Ports

SerialCommPorts

Page 17: 39245175 intro-es-ii

17

RTOS in an Embedded System

• Has a Kernel. Kernel coordinates the use of Processor for multiple tasks that are in ‘Ready’ State such that only one task is in ‘Running’ State

• Kernel schedules the transition of a task from – ‘Ready’ to ‘Running’ state– Also, from ‘Blocked’ to ‘Running’ state

(Preemptive scheduling) • Kernel schedules and dispatches a task to different

State than the present State

Page 18: 39245175 intro-es-ii

18

RTOS in an Embedded System• Kernel Controls the inter-process (task)

messaging and sharing of variables, queues and pipes.

• It schedules their working and execution by following a plan to control the latencies and Meet hard deadlines.

• RTOS has to be scalable. Memory is optimized by including only those parts of the “code” which are needed in the final software

Page 19: 39245175 intro-es-ii

19

Hard / Soft Real-Time Systems

• Soft Real-Time System– Compute output response as fast as possible,

but no specific deadlines to be met.• Hard Real-Time System

– Output response must be computed by specified deadline or system fails

Page 20: 39245175 intro-es-ii

20

Selection of RTOS• Requirements• Latencies• Tool Support• Processor Support• Type of Delivery• Inter Process Communication • Memory Management• Power Management

Page 21: 39245175 intro-es-ii

21

Design of Embedded Systems

• Task partitioning between hardware and software

• Hardware design and integration• Software development• System integration• Test strategies

Page 22: 39245175 intro-es-ii

22

Hardware-Software Partitioning

Some tasks could be performed usinghardware or software.Example:

A system receiving data packets needs to calculate a Cyclic Redundancy Check (CRC) value. If the packet is OK, an ACK signal should be sent within a specified time.

CRC could be calculated in S/W or by dedicated H/W.

Page 23: 39245175 intro-es-ii

23

Criteria for choice between H/W and S/W

• Hardware adds a “per unit” cost.• Software adds a “fixed cost”.• Hardware provides speed.• Software provides flexibility.• Software solution can reduce cost – at

least when production is in high volume.

• Hardware solution used when fast response is required.

Page 24: 39245175 intro-es-ii

24

Example of CRC check

Choice depends on how much time we have for sending the ACK signal.

If S/W is too slow, we have no choice – H/W must be used.

If S/W can meet the timing spec., we could use S/W.

S/W solution needs Real Time guarantee.

Page 25: 39245175 intro-es-ii

25

Hardware Design• Since a micro-controller in an embedded

system will run just one program all the time, hardware resources must be matched to needs of the application.

• Modern technology has made it possible to put the entire electronics – inclusive of sensors, analog circuits, digital circuits, DSP etc. on a single chip. (System On a Chip or SoC).

Page 26: 39245175 intro-es-ii

26

Hardware Design Challenges• Compatibility of the entire system• Interface design (linear to digital,

asynchronous to synchronous etc.)• Low power design• Modularity and ability to upgrade the system

in the field.• Time to market

Page 27: 39245175 intro-es-ii

27

Low Power Design

Especially important in 3 cases:

1. Battery operated and mobile systems – e.g. a portable MP3 music player

2. Systems with a limited power source – such as a smart public call booth which derives power from phone lines.

3. High complexity and speed systems – where heat dissipation is a problem

Page 28: 39245175 intro-es-ii

28

Low Power Design Techniques

• Power smart blocks which go to a low power or off mode when not in use.

• Reduced voltage swing on loaded buses.

• Coding schemes which minimize the number of transitions on signal lines.

• Reduced activity (toggling) .

• Reduced capacitances.

• Superior device engineering.

Page 29: 39245175 intro-es-ii

29

Software Design

• Software must provide the algorithms etc. needed for implementing the applications.

• These algorithms often have an impact on the choice of hardware as well. For example, whether a DSP processor should be used or not.

• Most embedded system software needs to be real time software.

Page 30: 39245175 intro-es-ii

30

Generic Requirements

• Software must be– Modular– Should be reusable, adaptable – Well documented

• In embedded systems, hardware and software design must go hand in hand

Page 31: 39245175 intro-es-ii

31

Considerations inSoftware Development

• Choice of assembly language versus high level languages

Most systems use high level languages these days.

However, embedded system software needs to be much more “hardware aware” than generic software.

It is not uncommon to find assembly language inserts in high level language software.

Page 32: 39245175 intro-es-ii

32

Real Time Systems• Real time systems have to guarantee that

they will respond to an external event within a specified amount of time.

• Real Time systems don’t have to be “real fast”. They do have to be reliably “on time”.

Page 33: 39245175 intro-es-ii

33

Really Real Time

Cycling the rocket cone to the launching pad!

Venue: TERLS

Trivandrum

Year: 1966

Page 34: 39245175 intro-es-ii

34

Type of Real Time Systems

Based on the type of timing guarantee they provide, real time systems are classified as

“soft real time”

or

“hard real time”.

Page 35: 39245175 intro-es-ii

35

Soft Real Time Systems

• Soft real time systems provide a time guarantee, but missing an event is not catastrophic.

• For example, image decoding used during satellite TV reception must be completed within a “frame time”.

• If this guarantee is missed, there will be a visible glitch.

• Annoying – but not catastrophic!

Page 36: 39245175 intro-es-ii

36

Hard Real Time Systems

• Hard real time systems are used when missing a timing deadline will lead to catastrophic results.

• For example, a missile guidance system should not miss any events!

Page 37: 39245175 intro-es-ii

37

So why use soft real time systems at all?

• Both soft and hard real time systems provide a real time guarantee. But if we can afford to miss a few events, this guaranteed response time can be much shorter.

• Soft real time systems would be used in non-critical applications which need to be very fast.

Page 38: 39245175 intro-es-ii

38

Hard and SoftReal Time Systems

The time guarantee provided by soft real time systems is statistical in nature – whereas that provided by hard real time systems is absolute.

Design of soft real time systems optimizes average case response – whereas hard real time systems must be designed for worst case situations.

Page 39: 39245175 intro-es-ii

39

Is real time software any different?

• Interrupt handling has to be specially careful.

• Since interrupt handling and task scheduling is done at the operating system level, special real time compliant operating systems should be used.

Page 40: 39245175 intro-es-ii

40

Constraints in Embedded Applications

(1) Functionality: with-in available System Memory and Processor Speed

(2) Complex Algorithms: As in an Automobile Engine - Performs complex filtering functions to optimize performance of the car while minimizing pollution & Fuel utilization.

(3) User Interface: Multiple GUI Menus / Options, Moving Maps in Global Positioning System, Navigation needs sophisticated User Interface

User inputs from front panel / Remote LAN port

Page 41: 39245175 intro-es-ii

41

Constraints in Embedded Applications

(4) Meet hard deadlines: Missing deadlines in Real time

(i) Could break a system (if data is not ready)

(ii) Could cause unsafe operation, endanger lives

(iii) Results in unhappy customers: Missed deadline in Printer printing a Scrambled Page

Page 42: 39245175 intro-es-ii

42

Constraints in Embedded Applications

(5) Multi-Rate: Several activities having slow and high rates being processed simultaneously.

Example: Audio and Video portions of a multimedia stream run at different rates. But, they must remain closely synchronized with-in 160 mS

Failure to meet deadline on either the audio or video portion spoils the perception of entire presentation.

Page 43: 39245175 intro-es-ii

43

Constraints in Embedded Applications

(6) Manufacturing Cost: Total cost of building system is important.Cost is determined by the type of processor, memory size and peripherals devices.

(7) Limited Power consumption: Large Power increases thermal rise, cost and size of product.

If Battery powered, may affect battery life.

Page 44: 39245175 intro-es-ii

44

Software Components

• Device drivers• Schedulers• Real time routines• Non real time routines• Inter process communications– Pipes– Semaphores etc

• Watchdog timers

Page 45: 39245175 intro-es-ii

45

Inter-Process Communications

• Signals

• Pipes and FIFO’s

• Message Queues

• Semaphores

• Shared Memory