Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from this space and version 3.05

If enabled, OS_IdleTask() is the very first task created by µC/OS-III and always exists in a µC/OS-III-based application. The priority of the idle task is always set to OS_CFG_PRIO_MAX-1. In fact, OS_IdleTask() is the only task that is ever allowed to be at this priority and, as a safeguard, when other tasks are created, OSTaskCreate() ensures that there are no other tasks created at the same priority as the idle task. The idle task runs whenever there are no other tasks that are ready-to-run.

If RAM space is tight, the idle task can be removed. This allows the user to save some data space since there is no need to have a stack for the idle task. However, even if there is not an actual task running at priority OS_CFG_PRIO_MAX-1, the user cannot create a task at that priority level. The level is still used to determine when to idle the CPU.

The important portions of the code for the idle task are shown below (refer to os_core.c for the complete code). These portions are still executed even if the idle task is disabled in os_cfg.h.