RL-ARM User's Guide

Defining Tasks

Real-Time or multitasking applications are composed of one or more tasks that perform specific operations. The RTX kernel supports a maximum of 255 tasks.

Tasks are simply C functions that have a void return type, have a void argument list, and are declared using the __task function attribute. For example:

__task void func (void);

where

funcis the name of the task.

The following example defines the function task1 as a task. This task increments a counter indefinitely.

__task void task1 (void) {
  while (1) {
    counter0++;
  }
}

Note

  • All tasks must be implemented as endless loops. A task must never return.
  • The __task function attribute must prefix the task function declaration in RTX kernel version 3.40 and newer.