31
Real-Time Systems Real-Time Systems Introduction Introduction Dr. C.H. Wei Southern Taiwan University of Technology

Real-Time Systems Introduction

Embed Size (px)

DESCRIPTION

Real-Time Systems Introduction. Dr. C.H. Wei Southern Taiwan University of Technology. Real-Time Operating Systems (RTOS) :. Operation System ( 作業系統) Embedded System ( 嵌入式系統) Real Time System ( 即時系統) Real Time Embedded System ( 嵌入式即時系統). 9,000. 8,000. 7,000. 6,000. 5,000. M units. - PowerPoint PPT Presentation

Citation preview

Page 1: Real-Time Systems Introduction

Real-Time Systems Real-Time Systems IntroductionIntroduction

Dr. C.H. Wei

Southern Taiwan University of Technology

Page 2: Real-Time Systems Introduction

Real-Time Operating Systems (RTOS):

•Operation System (作業系統 )•Embedded System (嵌入式系統 )•Real Time System (即時系統 ) •Real Time Embedded System (嵌入式即時系統 )

Page 3: Real-Time Systems Introduction

History and Future of MCU (1)

01,0002,0003,0004,0005,0006,0007,0008,0009,000

M u

nit

s

1997199819992000200120022003200420052006

4-Bit 8-Bit 16-Bit 32-bit+

Over 60億片 in 2003

By SEMICO

In last 20 years, 8 bits MCU were domestic Application of embedded 32Bits MCU grosses rapidly

Page 4: Real-Time Systems Introduction

History and Future of MCU (2)

$0

$5,000

$10,000

$15,000

$20,000

$M

1997 1998 1999 2000 2001 2002 2003 2004 2005 2006

4-Bit 8-Bit 16-Bit 32-bit+

Total MCU Market (to 200 億 $)

Conclusion: for 8/16/32 bits MCU, 1/3 + 1/3 + 1/3

By SEMICO

Page 5: Real-Time Systems Introduction

Problems on MCU Education

• Start from Z-80• An 8051 for everything (should be CSIC)• Use Simulators

• Education switches to 8/16/32 bits in parallel• JTAG ONCE BDM replaces the simulator• RTOS should be introduced• Need renew platforms for education

Page 6: Real-Time Systems Introduction
Page 7: Real-Time Systems Introduction
Page 8: Real-Time Systems Introduction

Typical Embedded System

MCU·CORE

KEYPAD

LCD DISPLAY

MAGCARD

READER

Real Timer

GSM MODULER

IrDA Interface

RS232 Interface

ICCARD

READER

Thermal Printer

Memory & Decoder

POWER

Page 9: Real-Time Systems Introduction

Why RTOS?

allows you to divide an application to multi-tasks; Simplify the application programming:

• Easier to modify, extend, maintenance• Guarantee the system latency reach or close to

the theoretical limits • Higher the reliability and system performance

Fill the gap between application engineer & expert of Computer

Page 10: Real-Time Systems Introduction

Multi-Tasks Bring Problems ! Races in tasks Died lock priority inversion Reentrancy Communications between tasks

……RTOS takes care of all above problems for you!

• RTOS is a nice tool for Embedded System• You have to LEARN How to Use It!

Page 11: Real-Time Systems Introduction

Commercial RTOS ProductsVxWorks Wind RiverSystem $40k/s & royalty wrs.compSOS Wind RiverSystem wrs.comVRTX Microtec $20K/seatLynxOS $10K/s, Bulue Cat Linux $2.5k/seat lynuxworks.com QNX QNX qnx.comOS-9 Microware Microware.comNucleus Accelerated Tech. $20K/s with source codeCMX 8051Tools Tasking $1.29k Tasking.comRT/Studio IDE Precise $30K psti.com Embedded Linux Green Hill $7.9K Royalty free ghs.com Embedex Linux Lineo $5k/seat lineo.comRedice Linux Redsonic redsonic.com Yellow Dog linux, Hard Hat Linux, Turb Linux Montavista.com Other: Linuxnews.com LinuxDevices.com Embed.com

Page 12: Real-Time Systems Introduction

Licensing: 

You do not need a license to use this code in your application, if your application is distributed in object format. You should however, indicate in your product literature that you are using μC/OS, the Real Time Kernel.  If you distribute μC/OS in source code, you must obtain a license.  

The μC/OS Book1992

Page 13: Real-Time Systems Introduction

The µC/OS-II Book

1998

License policy changed since µC/OS 1.0:You must obtain an Object Code Distribution License to embedded µC/OS-II in commercial product that is sold with the intent to make profit

No licensing is required if µC/OS-II is used for education

Page 14: Real-Time Systems Introduction

The 2nd edition of µC/OS-II June 2002

From 498 pages to 606 pages Delete 150 pages source code list. 250 new pages more

From 12 Chapters to 18 Chapters

Meet Requirement for Safety-Critical System

June 2003584 pages

Page 15: Real-Time Systems Introduction

µC/OS (V1.08) vs. µC/OS-II(V2.00)266 page to 498 pages

Add more important functions:Add more important functions:

Memory manager

stack usage check

CPU load check

Page 16: Real-Time Systems Introduction

µC/OS-II (V2.00 1998) vs. µC/OS-II(V2.52 2002)

““MicroC/OS-II The Real-time Kernel”MicroC/OS-II The Real-time Kernel”

The Second Edit (2002) The Second Edit (2002) Add 250 pages moreAdd 250 pages more

Meet Requirement for Safety-Critical System

Certified by FAACertified by FAA

Add more important functions:Add more important functions:Mutax Semaphore, Event Flag , Debug……

Add more explanationsAdd more explanations

Add Porting and TestingAdd Porting and Testing

Page 17: Real-Time Systems Introduction

Real-Time SystemsMar. 2000

12 Chapters, 610 pages

Page 18: Real-Time Systems Introduction

Real-Time Systems Jane W.S. Liu

1. Introduction 2. Reference Model for Real-Time Systems3. Scheduling Approaches4. Clock-Driven Scheduling5. Practical Aspects of Cyclic Executives 6. Priority-Driven Scheduling7. Resource Access8. Aperiodic and Sporadic Tasks9. Operating Systems Issues

Scheduling in SystemVR4Preemption Latency in LinuxI/O Handling in Windows NT/2000

10. Data Caching in Real-Time Systems 11. Real-Time Communication12. IETF Integrated Services 13. Network Calculus

Page 19: Real-Time Systems Introduction

Real-Time SystemsJan. 1997

9 Chapters, 448 pages

Page 20: Real-Time Systems Introduction

Real-Time Systems C. M. Krishna and K. G. Shin

1. Introduction. 2. Characterizing real-time tasks and systems. 3. Task assignment and scheduling. 4. Programming languages and tools. 5. Real-time databases. 6. Real-time communication. 7. Fault-tolerance techniques. 8. Reliability evaluation techniques. 9. Clock synchronization. Appendix. Review of modeling techniques.

Page 21: Real-Time Systems Introduction

Real-Time SystemsMar. 2001

10 Chapters, 224 pages

Page 22: Real-Time Systems Introduction

Real-Time Systems and Software Alan C. Shaw

1. Introduction: The World of Real-Time Systems.

2. Software Architectures. 3. Requirements and Design Specifications. 4. Systems of State Machines. 5. Declarative Specifications. 6. Deterministic Scheduling. 7. Execution Time Prediction. 8. Keeping Time on Computers. 9. Programming Languages. 10. Operating Systems. Appendix: Air Traffic Control System — Project

Specifications.

Page 23: Real-Time Systems Introduction

Real-Time Concepts for Embedded SystemsJuly 2003

16 Chapters, 294 pages

Page 24: Real-Time Systems Introduction

Real-Time Concepts for Embedded Systems

1. Introduction2. Basics of developing for embedded systems3. Embedded system initialisation4. Tasks5. Semaphores6. Message queues7. Other kernel objects8. Other RTOS services9. Exceptions10. I/O subsystem11. Memory management

Page 25: Real-Time Systems Introduction

µC/OS Already Widely Used in Many Fields

Already used in the field since 1992 such as: Already used in the field since 1992 such as: cameras medical instruments musical instruments engine control

Since 1995, ported it to MC68HC11, M68000, Since 1995, ported it to MC68HC11, M68000, CPU32,M.core,HC08 and used it in several projects:CPU32,M.core,HC08 and used it in several projects:

Digital Data Log MCU based TCP/IP stack

network adapter highway telephone call box ATM machine industrial robots……

Page 26: Real-Time Systems Introduction

µC/OS, µC/OS –IIµC/OS, µC/OS –II the RT Kernel

Dedicated Designed for Embedded SystemDedicated Designed for Embedded System Priority based Priority based preemptivepreemptive kernel kernel (simple (simple

algorithm)algorithm) Above Above 90%90% is written in is written in C, C, easy for porting easy for porting ScalableScalable and and ROM ableROM able Source code for Source code for PC PC environment attached environment attached

with a CD with a CD Very detail Very detail explanationexplanation in excellent in excellent

programming style programming style

So good for education!So good for education!

Page 27: Real-Time Systems Introduction

Pending

Dormant

Dormant

Wai

tin

gW

aiti

ng

ISRISR

RTOSRTOSKernelKernel

Running

Running

OSSemPend()

OSMBoxPend()

OSQPend()

OSTimeDly()

OSSemPost()

OSMBoxPost()

OSQpost()

OSTimetick()

OS_Task_SW()

IntEnter()IntExit()

OSTaskCreat()OSTaskDell()

OSInit()

OSStart()

Enter_Critical()Exit_Critical()Schedule_lock()ScheduleUnlock()TaskChangePrio()…...

RTOS Kernel Source Code µC/OS-II Service

Page 28: Real-Time Systems Introduction

Available Compilers• Diab data (now part of Windriver)

– ANSI-c / c++– Platforms: windows 95, windows NT, OS/2, Solaris, SunOS, HP/UX, IRIX, aix, – Http://www.WindRiver.Com/products/html/dcc_compiler.Html

• Green hills– Standard C++, extended embedded C++– Host platforms: windows 95, 98, NT and sparc/solaris– Http://www.Ghs.Com/products/mcore_development.Html

• Hiware– ANSI-C / C++ / EC++ / cc++ compilers– Host platforms: windows 95, 98, NT– Http://www.Hiware.Com/p_mcore.Html

• Metrowerks– ANSI C compliant, ANSI/ISO C++ compliant and EC+ compilers– Host platforms: windows 95, 98 and NT– Http://www.Metrowerks.Com/embedded/mcore/

• Motorola GNU toolkit– GNU C and C++ compilers– Http://sarl.Corp.Mot.Com/mcore/gnu/

Page 29: Real-Time Systems Introduction

Free C Compile: GNU gcc Tolls

•GNU gcc Tools•Cross C Compiler for:

M68K, CPU32, Coldfire, M.Core, PowerPC, 68HC11/12,SPARC,PA,RISC,VAX,AMD29K, ARM,Thumb,MN10xxx, M32, SR6000,MIPS,

RT, i386, Inter960,TMS32, DEC alpha, V850,NS32K•Cross assembler : AS•Disassemble: Objdump•Liker: Ld•C support lib: Libc & Libm•Gcc Debug options

–You know GCC , You will get also Embedded ucLinux

Page 30: Real-Time Systems Introduction

Porting µC/OS –IIPorting µC/OS –II

• Compiler with Hiware• Down loaded with Picobug

Or: • Compiler with CodeWarrior• Down loaded with EDBI tool

Page 31: Real-Time Systems Introduction

uCLinux in Linux

• Take off the Memory Management – Good for the non-mmu CPU in Embedded

• Free OS for Embedded• Many application program in Linux available • Not a Real Time OS !Download RTLinux3.1 from:www.rtlinux.org

• Much smaller than Linux, sometimes still too large for Embedded system typical RAM usage ~512K

• Down load from: www.uclinux.org