MDK-ARM Keil, MDK-ARM Datasheet - Page 23

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
Getting Started: Building Applications with RL-ARM
23
The first task can create further active tasks with the os_tsk_create() function.
This launches the task and assigns its task ID number and priority. In the
example above we have two running tasks, task2 and task3, of the same priority,
which will both be allocated an equal share of CPU runtime. While the
os_tsk_create() call is suitable for creating most tasks, there are some additional
task creation calls for special cases.
It is possible to create a task and pass a parameter to the task on startup. Since
tasks can be created at any time while RTX is running, a task can be created in
response to a system event and a particular parameter can be initialized on
startup.
tskID3 = os_tsk_create_ex (Task3, priority, parameter);
When each task is created, it is also assigned its own stack for storing data during
the context switch. This task stack is a fixed block of RAM, which holds all the
task variables. The task stacks are defined when the application is built, so the
overall RAM requirement is well defined. Ideally, we need to keep this as small
as possible to minimize the amount of RAM used by the application. However,
some tasks may have a large buffer, requiring a much larger stack space than
other tasks in the system. For these tasks, we can declare a larger task stack,
rather than increase the default stack size.
static U64 stk4 [400/8];
A task can now be declared with a custom stack size by using the
os_tsk_create_user() call and the dedicated stack.
tskID4 = os_tsk_create_user (Task4, priority, &stk4, sizeof (stk4));
Finally, there is a combination of both of the above task-creating calls where we
can create a task with a large stack space and pass a parameter on startup.
static U64 stk5 [400/8];
tskID5 = os_tsk_create_user_ex (Tsk5, prio, &stk5, sizeof (stk5), param);
Exercise: Tasks
This exercise presents the minimal code to start the RTOS and create two
running tasks.

Related parts for MDK-ARM