PowerPoint 演示文稿

Download Report

Transcript PowerPoint 演示文稿

Open Resources of RTOS
for Embedded Systems
Beibei Shao Tsinghua University
Conference on Nuclear Electronics & Detection
Dec. 2/4, 2002 in XiaMen
Why RTOS?
• Learn RTOS:
– Fill the gap between Computer Science
Experts and Application Engineers
– Understanding Computer more
theoretically
• Using RTOS:
– Simplify the Application Programming
– Higher the Real Time Performance and
Reliability
Real Time Kernel
RTOS
Kernel
Commercial RTOS Products
VxWorks Wind RiverSystem $40k/s & royalty
wrs.com
pSOS
Wind RiverSystem
wrs.com
VRTX
Microtec
$20K/seat
LynxOS $10K/s, Bulue Cat Linux $2.5k/seat
lynuxworks.com
QNX
QNX
qnx.com
OS-9
Microware
Microware.com
Nucleus Accelerated Tech. $20K/s with source code
CMX 8051Tools Tasking
$1.29k
Tasking.com
RT/Studio IDE
Precise
$30K
psti.com
Embedded Linux Green Hill
$7.9K Royalty free ghs.com
Embedex Linux
Lineo
$5k/seat
lineo.com
Redice Linux
Redsonic
redsonic.com
Yellow Dog linux, Hard Hat Linux, Turb Linux Montavista.com
Other: Linuxnews.com LinuxDevices.com
Embed.com
Why Open Source?
•
•
•
•
•
Good for Learning and training
Easy to Get Support from Web
Easy Common Language & Standard
Good Performances and reliabilities
Lower the System Cost
Free RTOS Kernel Source Code



“µC/OS The Real Time Kernel” (1992)
“MicroC/OS-II The Real-time Kernel” (1998)
“MicroC/OS-II The Real-time Kernel” 2nd Edit
(2002)
Jean J.Labrosse
R & D Publications, Inc
www.cmpbooks.com






Priority based preemptive kernel (looking up table algorithm)
Up to 60 tasks
Above 90% is written in C easy for porting
Scalable and ROM able
Source code for PC environment attached with a floppy or CD
Very detail explanation in excellent programming style
The μC/OS Book
1992
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-II
Book
1998
Licensing
No licensing is required if
µC/OS-II is used for
education
You must obtain an Object
Code Distribution License
to embedded µC/OS-II in
commercial product hat is
sold with the intent to
make profit
The
µC/OS-II
Book in Chinese
2001.7.
The 2nd edit of
µC/OS-II
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
µC/OS (V1.08) vs. µC/OS-II(V2.00)
266 page to 498 pages

Add more important functions:

Memory manager

stack usage check

CPU load check
µC/OS-II (V2.00 1998) vs. µC/OS-II(V2.52 2002)
“MicroC/OS-II The Real-time Kernel”
The Second Edit (2002) Add 250 pages more
Meet
Requirement for Safety-Critical System
Certified by FAA
Add
more important functions:
Mutax Semaphore, Event Flag ……
Add
more explanations
Add
price from $69.95 to $74.95 ,
Embedded Real Time System Concept

Foreground/background system (super loop+events)
Non-preemptive kernel (Multi Tasks latency=longest )

Preemptive Kernel


Races in tasks
 Died lock, priority inversion
 Reentrancy

Task scheduling algorithm
 Task priority based
 Round robin scheduling
Inter tasks communication, synchronization


Semaphore
 Mail box
 message queue
 ……
Real Time System Concept
Task Scheduling Algorithm
Priority based (Real Time scheduling)
Priority scheduling like µC/OS-II and most
commercial RTOS
Time slot based (Unix, Linux…..)
Round robin scheduling
Guaranteed Scheduling
Shortest job first
Lottery Scheduling
Multiple queues
Two levels scheduling
Scheduling mechanism and Scheduling policy
Refer to Minix, Linux
RTOS Kernel Source Code
µC/OS-II Service
OSTaskCreat()
OSTaskDell()
RTOS
Kernel
Enter_Critical()
Exit_Critical()
Schedule_lock()
ScheduleUnlock()
TaskChangePrio()
…...
Advantage/Disadvantage of Using
RTOS

Advantage




Split application to multi tasks, simplify the design,
easy to be understand, expend and maintenance
Time latency is guaranteed
Higher system reliability
Disadvantage



More RAM/ROM usage
2~5% CPU overhead
Adding additional cost, if commercial TROS is used
About 80 RTOS vendors, cost from $70 to $30,000 some are
royalty free, some need $5 to $250 /MCU, MCU dependent
µC/OS Already Widely Used in Many Fields

Already used in the field since 1992 such as:





cameras
medical instruments
musical instruments
engine control




network adapter
highway telephone call box
ATM machine
industrial robots……
Since 1995, our lab. ported it to MC68HC11, M68000,
CPU32,M.core,HC08 and used it in several projects:





Digital Data Log in National Synchrotron Radiation Lab.
WorldFip and radiation tolerance test DAQ system at CERN
Beam Lose Monitoring System
ATP System for Beijing light Railroad
MCU based TCP/IP stack
Free RTOS Kernel Source Code
Ported Examples down load able from web
Manufacture
AMD
Analog Device
ARM
Atmel
Fujitsu
Hitachi
Infineon
Intel
Motorola
Philips
ST
TI
Automation
Zilog
MCU
80x86
SHARC (AD21065L)
ARM7
AVR, AT103
SPARC
64180, H8-300H H8S,SH2,SH3
Tri.Core, 80C166/167
Strong ARM110, 80C251,XC52,80x86 ,196K
M68HC08, M68HC11, M68HC12, M68HC16
M68000, CPU32, DSP568xx
Cold.Fire, M.Core, PowerPC 8xx,MPC555
XA
80C166/167
TMS320-C40, TMS320-C6201
V8
Z-80, Z-180
http://WWW.uCOS-II.com/
Learn RTOS with µC/OS-II
•
•
•
•
Read the book and the µC/OS-II source code
– Understanding RTOS concepts
Compiler the µC/OS-II with examples and run on a PC
– Add some codes to the examples
Porting the µC/OS-II to a MCU, which you are familiar
with
– Write the CPU.c and the CPU.a files
Do a project with a MCU board
– Learn how to divide an application to several tasks
– Communication and synchronization within tasks
Porting & Using µC/OS-II
• Porting
– Most problems in porting are related to cross
C compiler tools
– Most MCU dependent Cross C are commercial
Please use GNU gcc in Free Software Linux
• Using
– How to develop applications program based
on µC/OS-II ?
GNU gcc in Linux
• GNU gcc Tools
• Cross C Compiler for:
•
•
•
•
•
M68K, CPU32, Coldfire, 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: Objump
Liker: Ld
C support lib: Libc & Libm
Gcc Debug options
– You know GCC , You will get also Embedded ucLinux
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
Free RTOS: RTEMS
RTEMS (Real-Time Executive for Missile Systems)
POSIX API standard based
Real-Time Executive for Multiprocessor Systems
(C Version)
Real-Time Executive for Military Systems(ada
Version)
• See:www.oarcorp.com/TREMS/
(On-Line Applications Research Corporation )
How to Develop an Application Program
Base on a RTOS?
TCP/IP Developing Examples
• Hardware platform design and test
• Buildup free software base developing environment
– GNU gcc
• Porting an RTOS
• Find out free resources
– Protocols form the www.rfc-editor.org
– Source code from books and www
• Develop your own application
Open Resources Example
TCP/IP Lean: Web Servers for Embedded Systems
is a hands-on guide to TCP/IP networking that includes
source code to a simple TCP/IP stack for use in embedded
applications.
68HC08GP32 Based Lean Server
68HC08GP32 Based Lean Server
•
•
•
•
8bits MCU 512bytes RAM 32K Fash
Run µC/OS-II for learning
Ethernet interface: RTL8019
Total code for TCP/IP is around 7K
68F375
MC 68332
MC68332 CPU32
ColdFire Platform for RTOS Learning
• 32 bits MCU ColdFire 5307:
– 68K in RISK , non MMU for Embedded
– 90MHz 75MIPs
• Interface with:
– Ethernet RTL8019
– 2M Flash, 16M SDRAM
• Developed with GNU gcc in Linux
• Boot uClinux or µC/OS-II from Flash to RAM
• TCP/IP stack available
Embedded Control Systems
Project for Ph.D. Student
实时操作系统VxWorks
VxWorks操作系统是美国WindRiver公司于1983年设计开发
的一种嵌入式实时操作系统(RTOS),是Tornado 嵌入式开
发环境的关键组成部分。良好的持续发展能力、高性能的内
核以及友好的用户开发环境,在嵌入式实时操作系统领域逐
渐占据一席之地。首先,它十分灵活,具有多达1800个功能
强大的应用程序接口(API);其次,它适用方面广,可以
适用于从最简单到最复杂的产品设计;再次,它可靠性高,
可以用于从防抱死刹车系统到星际探索的关键任务;最后,
适用性强,可以用于所有的流行的CPU平台。 Vxworks是一
个高性能的,支持广泛的网络通信协议的, 并可根据用户需求
进行组合的实时操作系统, 它的开放式结构和对工业标准的
支持使开发者只需要做最少的工作即可设计有效的符合用户
要求的实时操作系统.
实时操作系统VxWorks
BSP & Black Box
• Provides VxWorks with primary interface to
hardware environment.
• BSP Responsibilities:
– Hardware initialization on power-up.
– Support for VxWorks access to hardware drivers.
– Integration of hardware-dependent and hardwareindependent software in VxWorks.
实时操作系统 Nucleus
Nucleus是美国著名厂商ATI公司的RTOS产品。它提供实时内核(Nucleus
PLUS),网络模块(Nucleus NET、Nucleus EPILOGUE和Nucleus POSE),开
发工具模块(NucleusMNT/UDB/EDE/DLL)以及Web(Nucleus Java/webserve)
产品等。Nucleus最大的特点是全部提供源代码,免去用户购买License和付
Royalties。用户只需通过DLL动态连接库便可进行任务级调试,无需编写BSP。
★提供源代码
NUCLEUS+提供注释严格的C源级代码给每一个用户。这样,用户能够深
入地了解底层内核的运作方式,并可根据自己的特殊要求删减或改动系统软件
,这对软件的规范化管理及系统软件的测试都有极大的帮助。另外,由于提供
了RTOS的源级代码,用户不但可以进行RTOS 的学习和研究,而且产品在量产
时也不必支付License,可以省去大量的费用。
★ 易学易用
NUCLEUS+能够结合Paradigm,SDS以及ATI自己的多任务调试器组成功能
强大的集成开发环境,配合相应的编译器和动态联结库以及各类底层驱动软件
,用户可以轻松地进行RTOS的开发和调试。另外,由于这些集成开发环境 (
IDE ) 为所有的开发工程师所熟悉,因而,容易学习和使用。
★功能模块丰富
3种嵌入式操作系统比较
操作系统购买价格
★VxWorks:
价格40万元人民币以上
★Nucleus:
价格15万元人民币以上
★Linux & RTEMS:
免费
3种嵌入式操作系统比较
操作系统学习周期
★VxWorks:
一个人约4个月时间
★Nucleus:
一个人约1个月时间
★Linux or RTEMS:
一个人约2个月时间
3种嵌入式操作系统比较
操作系统可靠性稳定性
★VxWorks:
好
★Nucleus:
较好,有bug,特别在图形包,和网络包.
★Linux & RTEMS:
较好,在高性能系统中仍需改进
3种嵌入式操作系统比较
操作系统版权费用
★VxWorks:
每生产一件产品需交纳一份版权费
★Nucleus:
免费
★Linux & RTEMS:
免费
3种嵌入式操作系统比较
操作系统技术支持
★VxWorks:
较好,由开发商独家提供有限的技术支持
★Nucleus:
较好,由开发商独家提供有限的技术支持
★Linux & RTEMS:
好,全世界的自由软件开发者提供支持
3种嵌入式操作系统比较
操作系统网络特性
★VxWorks:
另加费用购买
★Nucleus:
另加费用购买
★Linux & RTEMS:
免费
3种嵌入式操作系统比较
操作系统软件移植
★VxWorks:
较难,是封闭系统
★Nucleus:
容易,代码开放
★Linux & RTEMS:
较易,有许多应用软件支持
3种嵌入式操作系统比较
操作系统实时性能
★VxWorks:
好,
★Nucleus:
较好,
★Linux:
非实时, (RTEMS 是实时的,基于Llinux).
3种嵌入式操作系统比较
操作系统应用产品开发周期
★VxWorks:
较慢,可参考的代码有限
★Nucleus:
快,新产品上市迅速
★Linux & RTEMS:
较快,许多公开的代码可以参考和移植
3种嵌入式操作系统比较
操作系统对内存占用
★VxWorks:
较少
★Nucleus:
少
★Linux & RTEMS:
多, 而且无法用虚拟内存改进
3种嵌入式操作系统比较
操作系统对新技术支持
★VxWorks:
较慢
★Nucleus:
慢,
★Linux:
快,甚至支持蓝牙技术
Future of Embedded RTOS
& Summery

Embedded RTOS is going to be Open and Open

µC/OS-II is good for learning and using

More and more RTOS source codes available include
many applications such as TCP/IP……

RTOS vendors focus to the service more and more
(Do apply for good service when you buy commercial RTOS!)
Thanks