c.core & µc/os-ii in education

34
C.core & µC/OS-II in Education Let more people know c.co re Beibei Shao Tsinghua University

Upload: mickey

Post on 25-Jan-2016

43 views

Category:

Documents


0 download

DESCRIPTION

C.core & µC/OS-II in Education. Let more people know c.core Beibei Shao Tsinghua University. 9,000. 8,000. 7,000. 6,000. 5,000. M units. 4,000. 3,000. 2,000. 1,000. 0. 1997. 1998. 1999. 2000. 2001. 2002. 2003. 2004. 2005. 2006. 4-Bit. 8-Bit. 16-Bit. 32-bit+. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: C.core &  µC/OS-II in Education

C.core & µC/OS-II in Education

Let more people know c.core

Beibei Shao

Tsinghua University

Page 2: C.core &  µC/OS-II in Education

History and Future of MCU (1)

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

M u

nit

s

1997 1998 1999 2000 2001 2002 2003 2004 2005 2006

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 3: C.core &  µC/OS-II in Education

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 4: C.core &  µC/OS-II in Education

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 5: C.core &  µC/OS-II in Education

C.core, Chinese Own Products C*CORE C210/C310 是苏州国芯公司受让 MOTOROLA 公司先进的 32 位 RISC CPU - M*CORE 而来,具有优越的性能和成熟的应用开发环境。高性能、低功耗、小体积高性价比的产品。

CC3118 是针对商业机和手持设备专门开发的高性价比的通用 MCU ,温度范围从 -40OC 到 85OC ,最大工作频率 60MHz 。

是我国自主设计的具有自主知识产权的 MCU

CC3118 把一个功能强大的 RISC C310 CPU 、功能强大的外围模块以及接口逻辑整合在一起,从而提高了整个系统的性能,同时减少了系统组件的数量,简化了系统开发难度,提高了应用系统的性价比。

Page 6: C.core &  µC/OS-II in Education
Page 7: C.core &  µC/OS-II in Education
Page 8: C.core &  µC/OS-II in Education

C.core CC3318

C.core 310 CPU

60MHz144pinsJTAG

64K RAM

SPI,3xSCIPWM2 x IC ReaderReal Time ClockLCD Driver (640 x 512)

Page 9: C.core &  µC/OS-II in Education

POS an Application Example

C·CORE 3118

KEYPAD

LCD DISPLAYER

MAGCARD READER

Real Timer

GSM MODULER

IrDA Interface

RS232 Interface

IC CARD READER

Thermal Printer

Memory & Decoder

POWER

This is also a good platform for education

Page 10: C.core &  µC/OS-II in Education

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 11: C.core &  µC/OS-II in Education

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 12: C.core &  µC/OS-II in Education

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 13: C.core &  µC/OS-II in Education

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 14: C.core &  µC/OS-II in Education

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 hat is sold with the intent to make profit

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

Page 15: C.core &  µC/OS-II in Education

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 16: C.core &  µC/OS-II in Education

Embedded System on the World

• The 1st International Embedded RTOS Application in Physics was in 1990

• The 1st National Embedded Conference was 2000 in China

• The 1st Email (www) in IHEP is in 1986, widely used 10 years later. To sorter the distance:

• In last 2 years, µC/OS-II was studied, ported, used widely.

• In coming 2 years, µC/OS-II based middleware should be discussed and published.

Page 17: C.core &  µC/OS-II in Education

µ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 18: C.core &  µC/OS-II in Education

Pending

Dormant

Wai

tin

g

ISR

RTOSKernel

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 19: C.core &  µC/OS-II in Education

Study Motivation

• Basic knowledge on embedded system and MCU for mamagers– To be a project manager, select right MCU direct in

the right way

• An useful tech. For Application Engineers– Use right MCU to develop products

• The way to an expert on embedded system – Please go ahead (to Linux…)

– Spend a lot of time!

Page 20: C.core &  µC/OS-II in Education

µ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, our lab. ported it to MC68HC11, M68000, Since 1995, our lab. 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 in National Synchrotron Radiation Lab. WorldFip and radiation tolerance test DAQ system at CER

N Beam Lose Monitoring System ATP System for Beijing light Railroad MCU based TCP/IP stack

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

Page 21: C.core &  µC/OS-II in Education

µ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 22: C.core &  µC/OS-II in Education

µ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 23: C.core &  µC/OS-II in Education

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 24: C.core &  µC/OS-II in Education

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 25: C.core &  µC/OS-II in Education

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

Page 26: C.core &  µC/OS-II in Education

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

• Compiler with Hiware• Down loaded with Picobug

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

Page 27: C.core &  µC/OS-II in Education

Picobug Debug Command

Page 28: C.core &  µC/OS-II in Education

Select S19 file to down load

Page 29: C.core &  µC/OS-II in Education

Downloaded

Page 30: C.core &  µC/OS-II in Education

Running µC/OS –IIRunning µC/OS –II

Page 31: C.core &  µC/OS-II in Education

Enhanced Background Debug Interface

• Features

– Win NT 4.0, win 95 and UNIX compatible

– Serial port based once debugger solution

– Low cost

– EIA-232 host interface at 115K baud

– Supports ESL protocol

– Low power consumption

– Manual reset button

– Status indication using multi-color LED's

– Supports M·CORE target systems that have a once debug connector

– User-upgradable firmware

17 Apr 00

Page 32: C.core &  µC/OS-II in Education

CodeWarrior Development Tool

Page 33: C.core &  µC/OS-II in Education

CodeWarrior Debug

Page 34: C.core &  µC/OS-II in Education

CodeWarrior IDE