資工系網媒所 news 實驗室 18:40 /800 introduction of eos embedded real-time operating...

81
資資資資資資 NEWS 資資資 19:02 /80 1 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

Upload: ashlee-harrison

Post on 12-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /801

Introduction of EOSEmbedded Real-Time Operating Systems

Introduction Real-Time Scheduling

VxWorksuCLinux Real-Time LinuxuC/OS-II

Page 2: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/802

Embedded OS trends 2001-2002, sorted by 2001 usage

0%

5%

10%

15%

20%

25%

30%

Hom

e grown

VxW

orks

DO

S

Em

bedded Linux

WinC

E

QN

X

Nucleus

Green H

ills

LynxO

S

Chorus

2001

2002

Page 3: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/803

Embedded OS trends 2001-2002, sorted by 2002 expectation

0%

5%

10%

15%

20%

25%

30%

Em

bedded Linux

VxW

orks

WinC

E

LynxO

S

BSD

Green H

ills

QN

X

DO

S

Chorus

Hom

e grown

2001

2002

Page 4: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/804

Real-Time Systems vs. Embedded Systems

RTS ESRTES

.Radar .Calculator.ABS

Page 5: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/805

Real-Time Systems

Time

Value

Hard RTS

Soft RTS

FirmRTS

Deadline

-Value

Page 6: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/806

RTOS at a Glance- http://www.onesmartclick.com/rtos/rtos.html

AMX, KwikNet, KwikPeg (from KADAK Products Ltd.) C EXECUTIVE (from JMI Software Systems, Inc.) CMX-RTX (from CMX Systems, Inc.)

DeltaOS (from CoreTek Systems, Inc.)

eCos (from Red Hat, Inc.)

embOS (from SEGGER Microcontroller Systeme GmbH) eRTOS (from JK microsystems, Inc.)

ETS (from VenturCom)

EYRX (from Eyring Corporation)

INTEGRITY (from Green Hills Software, Inc.)

INtime® real time extension to Windows® (from TenAsys Corporation)

IRIX (from SGI)

iRMX (from TenAsys Corporation)

Jbed (from esmertec, inc.)

LynxOS (from LynuxWorks)

MQX (from Precise Software Technologies Inc) Nucleus PLUS (AcceleratedTechnology, ESD Mentor Graphics)

On Time RTOS-32 (from On Time Informatik GmbH)

OS-9 (from Microware Systems Corporation)

OSE (from OSE Systems )

PDOS (from Eyring Corporation)

PSX (from JMI Software Systems, Inc.)

QNX Neutrino (from QNX Software Systems Ltd.)

QNX4 (from QNX Software Systems Ltd.)

REDICE-Linux (from REDSonic, Inc.)

RTLinux (from Finite State Machine Labs, Inc.)

RTX 5.0 (from VenturCom)

Portos (from Rabih Chrabieh)

smx (Micro Digital, Inc.)

SuperTask! (from US Software)

ThreadX (from Express Logic, Inc.)

Treck MicroC/OS-II (from Elmic Systems USA, Inc.)

TronTask! (from US Software)

TTPos: (from TTTech Computertechnik AG)

VxWorks 5.4 (from Wind River)

SCORE, DACS and TADS (from DDC-I)

Nimble - the SoC RTOS (from Eddy Solutions)

Nucleus (from Accelerated Technology)

Fusion RTOS (from DSP OS, Inc.)

FreeRTOS (from Richard Barry)

Page 7: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/807

What is a Real-Time System?

A system enforcing timing constraints, e.g. Avionics, Missile Control, …

The correctness of the system depends not only on the logical result of the computation, but also on the time at which the results are produced.

Real-Time vs. High Performance

What is a timing constraint?A constraint of timing requirements, e.g. period, distance, deadline, ready time, …

Functional and temporal correct.

Page 8: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/808

Real-Time Task Model

Periodic Task Model

parameters are known a priori

worst-case execution time

period

request time ready time deadline start finish preempt resume

Predictability vs. Schedulability

high predictability and schedulability

easy-to-check schedulability condition

Page 9: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/809

Real-Time System ExamplesIndustrial and automation systemComputer networking systemGaming and multimediaMedical instrument and devicesFinancial transaction applicationsMilitary defense systemSecurity monitoring and response systemData acquisition systemMachine vision/translation system…

Page 10: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/8010

Time-Driven Scheduling Approachwidely used

inflexible, efficient

large space needede.g. cyclic executive

Priority-Driven Scheduling Approachdynamic-priority

e.g. earliest deadline first

fixed-priority e.g. rate monotonic

0 3 6

0 3 6

Scheduling Approaches

Page 11: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/8011

Rate Monotonic

Job with smaller period gets higher priority.

Priority assignment is fixed (static).

0 3 61 2 4 5

1/2

1/3

1/6

Page 12: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/8012

Earliest Deadline First

Job with earlier deadline gets higher priority.

Priority is changing dynamically.

0 3 61 2 4 5

1/2

2/6

Page 13: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/8013

Earliest Deadline First : optimal dynamic-priority scheduler

job with earlier deadline gets higher priority

schedulability condition1

Rate Monotonic : optimal fixed-priority scheduler

job with smaller period gets higher priority

schedulability condition n (2

1/n- 1)

i

i

i

pe

Periodic Real-Time Schedulers

Page 14: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/8014

video serverinter-frame distance must be less than 33ms

robot arm movementneeds steady and smooth operations

satellite/cellular phone trackingservice in constant time interval

more predictable inter-execution time than the periodic task(PT) model

worst inter-execution time for PT is 2xperiod-ei

Distance-Constrained Task Model

Page 15: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/8015

Study of Pinwheel Scheduling

n tasks are schedulable on a node (using Sr) if the total utilization is less than or equal to n(2

1/n - 1).

n tasks are schedulable on all nodes (using DSr) if the utilization on any node is ≦2

1/n-1.

Algorithm of O(n) to minimize the total task delays between two nodes.

Algorithm of O(mn) to minimize the total end-to-end delays on m nodes.

Page 16: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/8016

Time-driven Scheduling Approach

on-line approachexecute tasks according to off-line generated schedule or parameters

more flexible

off-line approachconstruct complete schedule

exponential time and space

generate effective time parametersstart time, resume time, finish time

optimization

0 3 6

Page 17: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/8017

SSr: Pinwheel Schedule Constructor

Generate start times and finish times in O(n2)

task5

5.30 10.6 15.9

task1

21.2

task2

task3

task4

Page 18: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/8018

Pinwheel Transformation

Pinwheel

any numbers multiples

jitterless, predictable

Signalanalog digital

noiseless, ease of control

e.g. CD music

2E.g. A={3,4,6,13} ={3,3,6,12} ={3,3,321, 322}• single-number reduction

30 6 9

A

B

12

(RM)

(PW)

Page 19: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/8019

Pinwheel Scheduling Properties

Good jitter control in schedules

Easy-to-check schedulability

Predictable resource accesses

Easy extension for aperiodic tasks

Predictable end-to-end delay

Network scheduling (INFOCOM’95 by Han & Shin)

Flexible time-driven approach

Page 20: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/8020

Comparison of Schedulers

Scheduler EDF RM Srb

schedulabilitycondition

1 n (21/n - 1) n (21/n - 1)

jitter high low* none

end-to-end delay long short shortest

resource reservation difficult easy* easy

worst caseblocking time

large large small

systemoverload

unstable stable stable

*for higher priority tasks

Page 21: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室/8021

RTOS

IntroductionVxWorksuCLinux Real-Time Linux

uC/OS-II

Page 22: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

國立台灣大學資訊工程學系

TORNADO II :VxWorks

Page 23: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8023

TORNADO II : VxWorks

Embedded Development Tools

VxWorks Real Time Operating System

Wind Microkernel

Snapshoot of Host Development Tools

Page 24: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8024

The Next Generation of Embedded Development Tools

Page 25: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8025

Host Development Tools (I)

WindViewA logic analyzer for real-time software.

Provides information about context switches, events, and instrumented objects.

CrossWindA remote source-level debugger.

It is an extended version of the GDB.

WindSHA host-resident command shell.

Provides interactive access from the host to all run-time facilities.

Page 26: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8026

Host Development Tools (II)

BrowserA system-object viewer, a graphical companion to the Tornado shell.

Provides display facilities to monitor the state of the target system.

CodeTestIt is a visualize tool to design code coverage analysis and tracking dynamic memory allocation.

Provides source code viewer-coverage and memory allocation by function.

Look!For C++ development, look inside source level bugs, to see object relationship, and all messages among objects.

Page 27: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8027

Host Development Tools (III)

WindNavigatorIt performs hierarchical browsing on the application code at working project mode by parsing source tree.

StethoscopeIt is a unique real-time graphic data monitor tool.

Watching any variable, see peak values, and look for otherwise miss.

Project ManagerSimplifies organizing, configuring, and building VxWorks applications.

Page 28: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8028

Host Development Tools (IV)

SimulatorIt is a port of VxWorks to the host system.

Simulates a target operating system.

3rd Party ToolsMore than 300 partners provide solutions.

Custom ToolsAn open extension architecture makes sample to custom tools for using Tornado.

Easy to create custom tool using TCL base tool API.

Page 29: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8029

VxWorks

Page 30: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8030

Wind Microkernel

Page 31: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8031

Embedded Internet

Page 32: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8032

Virtual Memory

Page 33: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8033

Multiprocessing

Page 34: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8034

Graphics

Page 35: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8035

File Systems

Page 36: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8036

Networking

Page 37: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8037

WindView

Page 38: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8038

Stethoscope

Page 39: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8039

RTOS

IntroductionVxWorksuCLinuxReal-Time Linux

uC/OS-II

Page 40: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

國立台灣大學資訊工程學系

Introduction to uClinux

Page 41: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8041

uCLinux

What is uClinux

Linux vs. uClinux

Features

Ported microcontrollers and microprocessors

Devices running uClinux

Related web sites

Page 42: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8042

What is uCLinux?

Embedded Linux/Microcontroller Project

Pronounced "you-see-linux"

"Mu" stands for "micro", and the "C" is for "controller "

Derivative of Linux 2.0 kernel

Intended for microcontrollers without Memory Management Units (MMUs)

Page 43: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8043

What is uClinux? (Cont.)

First ported to the Motorola MC68328: DragonBall Integrated Microprocessor.

First target system to successfully boot is the 3Com PalmPilot using a TRG SuperPilot Board.

Page 44: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8044

Linux vs. uClinux

Multitasking can be tricky with Non-MMU microprocessors.

Most user applications that run on top of uClinux, however, will not require multitasking.

Page 45: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8045

Linux vs. uClinux(Cont.)

But uClinux absolutely DOES support multi-tasking.

Although there are a few things that must be keep in mind:

There is no memory protection.

uClinux does not implement fork(); instead it implements vfork().

Stack does not autogrow. There is a compile time option to set the stack size of a program.

Page 46: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8046

Linux vs. uCLinux(Cont.)

Most of the binaries and source code for the kernel have been rewritten to tighten-up and slim-down the code base.

This all means that the uClinux kernel is much, much smaller than the original Linux 2.0 kernel.

Common Linux API

uCkernel < 512 KB

uCkernel + tools < 900 KB

Page 47: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8047

Feature

uClinux retains the main advantages of the Linux operating system.

NetworkFull TCP/IP stack, as well as support for numerous other networking protocols.

File systemsNFS

ext2

MS-DOS

FAT16/32

And more…

Page 48: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8048

Ported Microcontrollers and Microprocessors

uClinux is the leader in portability.Now uClinux is ported to:

Motorola DragonBall, ColdFire, QUICCHitachi H8300ARM7TDMIETRAXIntel i960PRISMAAtari 68kNEC V850E

Page 49: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8049

Devices running uClinux

Aplio’s voice-over-IP telephoneMCU: ARM7TDMI

Page 50: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8050

Devices running uClinux(Cont.)

AXIS 2100 Network CameraMCU: AXIS ETRAX

Place it anywhere - no PC required

High-quality images - up to 10 frames/sec

No extra accessories, software or video cabling needed

Built-in Web server

Page 51: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8051

Related Web Site

Wind River Homehttp://www.windriver.com/

The official site of uClinux:http://www.uclinux.org/

Page 52: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8052

RTOS

IntroductionVxWorksuCLinuxReal-Time LinuxuC/OS-II

Page 53: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

國立台灣大學資訊工程學系

Introduction to

Real-Time Linux

Page 54: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8054

Real-Time Linux

UTIME and KURT-Linux

RTLinux

RTAI

Page 55: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8055

UTIMEUTIME and KURT-Linux are developed by the Information and Telecommunication Technology Center (ITTC) at the University of Kansas

UTIME is now a part of the KURT-Linux distribution

http://www.ittc.ku.edu/utime/

Supports Intel 80x86 architecture

In Linux, timing resolution of kernel timer is restricted to 10 ms (80x86 architecture) due to the 100 Hz frequency of timer interrupt

Linux maintains the sense of time at every timer interrupts and handles the kernel timer in the timer interrupt bottom half

Page 56: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8056

Aims of UTIME

Provides microsecond level timing resolution for Linux kernel timer

Reprogram the timer chip of X86 as one-shot or periodic timer at any frequency

Use Time Stamp Counter (TSC register) of Pentium or timer chip itself for non-Pentiums to determine the time in a tick

Fully compatible with Linux kernel APIs and system calls (time(), nanosleep(), gettimeofday())

Page 57: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8057

Implementation of UTIME

Add additional field "usec" to the timer_list structure of Linux which indicates the microsecond within the current "jiffy" that the timer is to timeout

Added a "jiffies_u" variable which tracks the microseconds within a 10ms tick

Call the do_timer() routine (Linux timer interrupt handler) every jiffy by UTIME instead of timer interrupt handler

Page 58: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8058

Using the UTIME

User can take advantage of UTIME byThe nanosleep system call

Interval timers

The select system call

A custom kernel module

Page 59: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8059

UTIME nanosleep example

void nanosleep_test(int delay) {

struct timespec sleepy;

sleepy.tv_sec = 0;

sleepy.tv_nsec = delay * 1000;

nanosleep(&sleepy, 0);

}

Page 60: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8060

UTIME Interval Timer Examplevoid timer_handler(int signal) {

// This is a job of one real-time task}

void setitimer_test(int delay, int interval, int tries) {struct itimerval timer; sigset_t mask; struct sigaction action; int i;

timer.it_interval.tv_sec = 0;timer.it_interval.tv_usec = interval;timer.it_value.tv_sec = 0;timer.it_value.tv_usec = delay;

sigemptyset(&mask); action.sa_handler = timer_handler; action.sa_flags = 0; sigaction(SIGALRM, &action, 0); setitimer(ITIMER_REAL, &timer, 0); for (i = 0 ; i < tries ; i++) { sigsuspend(&mask); } timer.it_interval.tv_sec = 0; timer.it_interval.tv_usec = 0; timer.it_value.tv_sec = 0; timer.it_value.tv_usec = 0; setitimer(ITIMER_REAL, &timer, 0);}

Page 61: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8061

UTIME select and poll Example

void select_test(int delay) {

struct timeval timeout;

timeout.tv_sec = 0;

timeout.tv_usec = delay;

select(0, 0, 0, 0, &timeout);

}

void poll_test(int delay) {

poll(0, 0, delay);

}

Page 62: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8062

UTIME Kernel Module Example1 extern unsigned long volatile jiffies;

2 extern int volatile jiffies_u;

3 void timer_handler(unsigned long data) {

4 struct timeval now;

5 gettimeofday(&now, NULL);

6 }

Page 63: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8063

UTIME Kernel Module Example (cont’d)7 int init_module(void) {8 struct timer_list timer; unsigned long timeout; signed long timeout_u;9 struct timeval now;10 /* Initialize and set the timer to go off in 5ms */11 init_timer(&timer);12 timer.expires = jiffies;13 timer.usec = jiffies_u + 5000;14 if (timer.usec >= USEC_PER_JIFFIES) {15 timer.expires++;16 timer.usec -= USEC_PER_JIFFIES;17 }18 timer.data = 100;19 timer.function = timer_handler;20 timer.flags |= UTIME_OFFSET;21 /* Now add the timer. */22 add_timer(&timer);23 return 0;24 }

Page 64: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8064

Performance of UTIME (Pentium-200)

Page 65: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8065

Performance of UTIME without Pentium (Simulated by Pentium-200)

Page 66: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8066

KURT-Linux

Provide on-demand, microsecond resolution and real-time scheduling capabilities to the standard Linux kernelReal-time process could be kernel function (provide by UTIME) or user-space process using KURT APIhttp://www.ittc.ku.edu/kurt/Event-driven (time-driven) scheduling mechanism that switches tasks in an explicit order

Static real-time schedule – generate an off-line schedule and save it in a file and load this schedule from disk at run-timeDynamic real-time schedule – generate an off-line schedule and submit this schedule at run-time

Page 67: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8067

API of KURT-Linux

KURT Pseudo DeviceOnly three operations, open, close and ioctl

KURT kernel subsystem uses this device to communicate with user space programs

Used by KURT API library

KURT APIDLL which is linked with real-time process

General and Utility operations

Process Initialization, registration, and control

Schedule submission

Page 68: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8068

KURT-Linux Architecture

Page 69: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8069

General and Utility Operationskurt_open() – open an instance of the KURT pseudo device before doing any KUT API callsget_num_rtprocs() – return the number of real-time processes in KURTget_rtstats() – reports a process’s real-time behaviorget_rt_id_from_name() – retrieve a process’s real-time id via name lookupevent_stats() – prints real-time timer statistical informationproc_stats() – prints statistical information for all real-time processesset_scheduling_offset() – set the delay setting of UTIME, default is 20 microsecondsget_scheduling_offset() – get the delay setting of UTIME

Page 70: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8070

Process Initialization, Registration, and Control

rt_suspend() – suspends a real-time process

set_rtparams() – sets, resets, or unsets the real-time parameters for a process

get_rtparams() – retrieves the real-time parameters for a process

Page 71: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8071

Schedule Submission

rt_schedule_events() - submits a binary schedule file of contiguous real-time timers to the kernelset_scheduling_task() / clear_scheduling_task() – registers/unregisters current process as the KURT scheduling task, which is the only one task to assign the schedule to KURT-Linuxswitch_to_rt() – switches the kernel to a specific real-time modeswitch_to_normal() – disables real-time schedulingsubmit_dynamic_schedule() – submits a binary schedule of real-time timers type rt_timer_list into the kerneldisable_dynamic_schedule() – disables the dynamic scheduling facilities

Page 72: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8072

Real-Time Linux

UTIME and KURT-Linux

RTLinux

RTAI

Page 73: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8073

RTLinux

Hard real-time operating systemCoexists with Linux or BSD kernelRTLinux itself is non-preempriveRuns Linux as a lowest priority threadWorst case interrupt latency on a x86 is less than 15 microseconds from the moment the hardware interrupt is assertedUses a standard GDB DebuggerRuns on x86, PowerPC, Alpha, and MIPSProvides POSIX threads and signalshttp://fsmlabs.com

Page 74: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8074

Tasks in RTLinux

Real-time tasks in RTLinux are written as special Linux modules

Runs in the kernel space

Privileged

Do not use virtual memory.

RT-FIFOA user space process

Do system calls for RTLinux thread

Page 75: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8075

Detail of the bare Linux kernel

Hardware

UNIX/Linux kernelDevice Drivers

Hardware InterruptsI/O

System Libraries

User Processes

Page 76: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8076

RTLinux Kernel Architecture

Hardware

Hardware InterruptsI/O

UNIX/Linux kernelDevice Drivers

System Libraries

User Processes

RTLinux Plugin

Hardware InterruptsI/O

Linux is executed in the background

Real-time tasks

RT SchedulerDirectHardware

Access

Page 77: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8077

Data Flow in an RT Application

Page 78: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8078

RTLinux APIs

Basic APICreating RTLinux POSIX threadsTime facilitiesConversion routinesScheduling threads (priority-driven scheduler)

Advanced APIFloating point operations supportRTLinux IPC

Real-time FIFOsShared memoryWaking and suspending RTLinux threadsMutual exclusion

Accessing memoryInterrupts

Page 79: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8079

Real-Time Linux

UTIME and KURT-Linux

RTLinux

RTAI

Page 80: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8080

RTAI

Variant of RTLinux

http://www.aero.polimi.it/~rtai/

RTAI supports X86, PowerPC, ARM (StrongARM; ARM7: clps711x-family, Cirrus Logic EP7xxx, CS89712), and MIPS

Using RTHAL to trap LinuxA structure which contains function pointers and variables of Linux

Trap Linux kernel by replacing the function pointers in RTHAL

Page 81: 資工系網媒所 NEWS 實驗室 18:40 /800 Introduction of EOS Embedded Real-Time Operating Systems Introduction Real-Time Scheduling VxWorks uCLinux Real-Time Linux uC/OS-II

資工系網媒所 NEWS實驗室04:39 /8081

Architecture of RTAI