CooCox_CoOS_User_Guide.pdf
(
993 KB
)
Pobierz
Microsoft Word - CooCox CoOS用户手册英文完整版.doc
CooCox CoOS User's Guide
Revision 1.1
August, 2009
www.coocox.org
CONTENTS
1 OverView.................................................................................... 1
1.1 About CooCox CoOS............................................................. 1
1.2 CooCox CoOS getting started ................................................ 3
2 Task Management ........................................................................ 9
2.1 Task................................................................................... 9
2.2 Task State .........................................................................10
2.3 Task Control Blocks .............................................................12
2.4 Task Ready List...................................................................15
2.5 Task Scheduling..................................................................16
2.6 Critical Section ...................................................................18
2.7 Interrupts..........................................................................19
3 Time Management ......................................................................20
3.1 System Ticks......................................................................20
3.2 Delay Management .............................................................22
3.3 Software Timer...................................................................23
4 Memory Management ..................................................................25
4.1 Static Memory Allocation......................................................25
4.2 Dynamic memory management ............................................26
4.3 Stack Overflow Check..........................................................31
5 Intertask Synchronization&Communication .....................................32
5.1 Intertask Synchronization ....................................................32
5.2 Intertask Communication.....................................................38
6 API Reference.............................................................................41
6.1 System Management...........................................................41
6.2 Task Management ...............................................................47
6.3 Time Management ..............................................................58
6.4 Software Timer...................................................................62
6.5 Memory Management ..........................................................69
6.6 Mutex Section ....................................................................77
6.7 Semaphores.......................................................................80
6.8 Mailboxes ..........................................................................88
6.9 Message Queues.................................................................97
6.10 Flags ............................................................................. 107
6.11 System Utilities............................................................... 119
6.12 Others........................................................................... 122
2
1 OverView
1.1 About CooCox CoOS
CooCox CoOS is an embedded real-time multi-task OS specially for ARM
Cortex M series.
1.1.1 CoOS Features
l
Specially designed for Cortex-M series.
l
Free and open real-time Operating System.
l
Scalable, minimal system kernel is only 974Byte.
l
Adaptive Task Scheduling Algorithm.
l
Supports preemptive priority and round-robin.
l
Interrupt latency is 0.
l
Semaphore, Mutex, Flag, Mailbox and Queue for communication &
synchronisation
l
Stack overflow detection option.
l
Supports the platforms of ICCARM, ARMCC, GCC
1.1.2 Technical Data
Table 1.1.1 Time Specifications
N Function
Time(
No Robin/Robin
)
Create defined task, no task switch
5.3us/5.8us
Create defined task, switch task
7.5us/8.6us
Delete task (ExitTask)
4.8us/5.2us
Task switch (SwitchContext)
1.5us/1.5us
Task switch (upon set flag)
7.5us/8.1us
Task switch (upon sent semaphore)
6.3us/7.0us
Task switch (upon sent mail)
6.1us/7.1us
Task switch (upon sent queue)
7.0us/7.6us
Set Flag (no task switch)
1.3us/1.3 us
Send semaphore (no task switch)
1.6us/1.6us
Send mail (no task switch)
1.5us/1.5us
Send queue (no task switch)
1.8us/1.8us
Maximum interrupt lockout for IRQ ISR's
0/0
1
Table 1.1.2 Space Specifications
Description
Space
RAM Space for Kernel
168 Bytes
Code Space for Kernel
974 Bytes
RAM Space for a Task
TaskStackSize + 24 Bytes(MIN)
TaskStackSize + 48 Bytes(MAX)
RAM Space for a Mailbox
16 Bytes
RAM Space for a Semaphore
16 Bytes
RAM Space for a Queue
32 Bytes
RAM Space for a Mutex
8 Bytes
RAM Space for a User Timer
24 Bytes
1.1.3 Supported Devices (
CoOS supports all ARM Cortex M3 and Cortex M0 based
devices, here only lists some of the most common used:
)
n
ST STM32 Series
n
Atmel ATSAM3U Series
n
NXP LPC17xx LPC13xx LPC11xx Series
n
Toshiba TMPM330 Series
n
Luminary LM3S Series
n
Nuvoton NUC1xx Series
n
Energy Micro EFM32 Series
1.1.4 Source Codes Download
If you want to learn more about CooCox CoOS, you can download the
CooCox CoOS source code from the web:
http://www.coocox.org/
.
2
1.2 CooCox CoOS getting started
This section describes the useage of CooCox, here we use Keil RealView
MDK and EM-LPC1700 evaluation board to develop a simple demo based on
CooCox CoOS.
Here we assume that you are able to use Keil RealView MDK to do simple
development and basic set. The following will introduce a simple example which
includes three tasks:
led : Used for 8 LEDs' cyclic flickering, and set flags to activate the other
two tasks every fixed time interval;
taskA : Wait for task flag 'a_flag', then print taskA through UART1;
taskB : Wait for task flag 'b_flag', then print taskB through UART1;
The overall phenomenon is thatthe 8 LEDs on board changes every 0.5s,
the change order is :LED0
LED1
LED2
…
LED6
LED7
LED0
LED1
…,
the serial port prints messages every 0.5s, printing like this:
taskA is running
taskB is running
…
The corresponding relationships between LEDs and GPIOs are as follows:
LED0
P1.28
LED1
P1.29
LED2
P1.31
LED[3…7]
P[2.2...2.6]
Next we will introduce how to achieve the above functions in the
environment of CoOS.
1.2.1 Preparations
1> Visit
www.coocox.org
website to download '
The first CoOS Program
' source
code;
2> First of all, create a folder named 'getting_started'(Note: the name of the
folder can't has spaces or Chinese);
3>
And then enter the 'getting_started' folder, create a inc ,a src ,a ccrtos folder
3
Plik z chomika:
phill2k
Inne pliki z tego folderu:
STM32F103RB source code for CoOS Free RTOS Using ARMCC compiler - STM32F103RB_MDK3.80.zip
(189 KB)
STM32F103RB source code for CoOS Free RTOS (using CoIDE V1.0.0).zip
(201 KB)
STM32F103RB source code for CoOS Free RTOS (using CoBuilder V0.7).zip
(197 KB)
CoOS-1.1.3.exe
(340 KB)
CooCox_CoOS_User_Guide.pdf
(993 KB)
Inne foldery tego chomika:
CoLinkEx
Zgłoś jeśli
naruszono regulamin