Keil Logo

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

func is 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.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.