Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall...

41
Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings

Transcript of Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall...

Page 1: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Chapter 13Embedded Systems

Patricia RoyManatee Community College, Venice,

FL©2008, Prentice Hall

Operating Systems:Internals and Design Principles, 6/E

William Stallings

Page 2: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Embedded System

• Hardware and software designed to perform a dedicated function

• Tightly coupled to their environmnet

Page 3: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Examples

Page 4: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Examples

Page 5: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Embedded System Organization

Page 6: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Characteristics of Embedded Operating System

• Real-time operation• Reactive operation

– Respond to external events

• Configurability– Large variation in systems so need flexible

configuration

Page 7: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Characteristics of Embedded Operating System

• I/O device flexibility• Streamlined protection mechanisms• Direct use of interrupts

Page 8: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Adapting an Existing OS

• Add real-time capability• Streamlining operation• Add necessary functionality

Page 9: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

eCos

• Embedded Configurable Operating Systems

• Open source• Royalty-free• Real-time OS• Most widely used embedded OS

Page 10: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

eCos Configuration Tool

Page 11: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

eCos Configuration Tool

Page 12: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Loading an eCos Configuration

Page 13: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

eCos Layered Structure

Page 14: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Hardware Abstraction Layer

• Presents consistent API to upper layers• Different for each hardware platform

Page 15: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

HAL

Page 16: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

HAL Modules

• Architecture– Processor family type

• Variant– Support features of specific processor

• Platform– Support of tightly coupled peripherals

Page 17: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

eCos Kernel

• Low interrupt latency• Low task switching latency• Small memory footprint• Deterministic behavior

Page 18: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Not in eCos Kernel

• Memory allocation• Device driver

Page 19: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

eCos I/O System

• Framework for supporting device drivers

Page 20: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

eCos Scheduler

• Bitmap scheduler– Efficient for small number of threads active– Each thread has different priority

Page 21: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Bitmap Scheduler

Page 22: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

eCos Scheduler

• Multilevel queue scheduler– Appropriate when number of threads is

dynamic– Multiple threads at each priority– Time slicing

Page 23: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Multilevel Queue Scheduler

Page 24: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

eCos Thread Synchronization

• Mutexes• Semaphores• Condition variables

Page 25: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

eCos Thread Synchronization

• Event flags• Mailboxes• Spinlocks

– Useful in SMP (symmetric multiprocessing)

Page 26: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Mutexes

Page 27: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Mutexes and Condition Variables

Page 28: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Mutexes and Condition Variables

Page 29: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

TinyOS

• 400 bytes of code• Not a real-time OS• No kernel• No memory protection

Page 30: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Tiny OS

• Component-based OS• No processes• No memory allocation• Interrupt and exception handling

dependent on peripheral• Nonblocking

Page 31: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Wireless Sensor Network Topology

Page 32: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

TinyOS Goals

• Allow high concurrency• Operate with limited resources• Adapt to hardware evolution

Page 33: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

TinyOS Goals

• Support a wide range of applications• Support a diverse set of platforms• Be robust

Page 34: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

TinyOS Components

• Single-hop networking• Ad-hoc routing• Power management• Times• Nonvolatile storage control

Page 35: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

TimerM Component

Page 36: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

TimerM Configuration

Page 37: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

TinyOS Scheduler

• Operates across all components• Only one task executes at one time• Simple FIFO queue

Page 38: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Example TinyOS Appliction

Page 39: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Example TinyOS Appliction

Page 40: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

TinyOS Resource Interface

• Dedicated• Virtualized• Shared

Page 41: Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,

Shared Resource Configuration