MDK-ARM Keil, MDK-ARM Datasheet - Page 22

KIT REALVIEW MCU DEVELOPMENT

MDK-ARM

Manufacturer Part Number
MDK-ARM
Description
KIT REALVIEW MCU DEVELOPMENT
Manufacturer
Keil
Type
Compiler and IDEr
Datasheets

Specifications of MDK-ARM

For Use With/related Products
ARM MCUs
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
22
void main (void)
}
The os_sys_init () function launches RTX, but only starts the first task running.
After the operating system has been initialized, control will be passed to this task.
When the first task is created it is assigned a default priority. If there are a
number of tasks ready to run and they all have the same priority, they will be
allotted run time in a round-robin fashion. However, if a task with a higher
priority becomes ready to run, the RTX scheduler will de-schedule the currently
running task and start the high priority task running. This is called pre-emptive
priority-based scheduling. When assigning priorities you have to be careful,
because the high priority task will continue to run until it enters a WAITING
state or until a task of equal or higher priority is ready to run.
Tasks of equal priority will be
scheduled in a round-robin
fashion. High priority tasks will
pre-empt low priority tasks and
enter the RUNNING state “on
demand”.
Two additional calls are
available to start RTX;
os_sys_init_prio(task1) will start the RTOS and create the task with a user-
defined priority. The second OS call is os_sys_init_user(task1, &stack,
Stack_Size). This starts the RTOS and defines a user stack.
Creating Tasks
Once RTX has been started, the first task created is used to start additional tasks
required for the application. While the first task may continue to run, it is good
programming style for this task to create the necessary additional tasks and then
delete itself.
__task void task1 (void)
tskID2 = os_tsk_create (task2,0x10);
tskID3 = os_tsk_create (task3,0x10);
os_tsk_delete_self ();
}
IODIR1 = 0x00FF0000;
os_sys_init (task1);
{
{
// Do any C code you want
// Start the RTX call the first task
// Create the second task
// and assign its priority.
// Create additional tasks
// and assign priorities.
// End and self-delete this task
Chapter 2. Developing With an RTOS

Related parts for MDK-ARM