Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Interrupt priority of idle task.

Posted by Bill Yang on September 5, 2008
Hi, I am really confusing the tskIDLE_PRIORITY is defined to 0 in the demo of Cortex_LM3X_IAR_KEIL, which means the idle task has the highest priority. But the Cortex-M3 interrupt priority has been specifically mentioned in the Demo App Introduction as below.
A special note for Cortex M3 users: Remember that Cortex M3 cores use numerically low priority numbers to represent HIGH priority interrupts, which can seem counter-intuitive and is easy to forget! If you wish to assign an interrupt a low priority do NOT assign it a priority of 0 (or other low numeric value) as this can result in the interrupt actually having the highest priority in the system - and therefore potentially make your system crash if this priority is above configMAX_SYSCALL_INTERRUPT_PRIORITY.
The idle task should be the lowest priority task that it can be preempted by other tasks who has higher interrupt priority. I wonder if anyone can answer my question. Why the tskIDLE_PRIORITY is set to 0?
Bill Yang

RE: Interrupt priority of idle task.

Posted by Richard Damon on September 5, 2008
You are confusing TASK priorities with INTERRUPT priorities. INTERRUPT priorities are set by the hardware, and the Cortex M3 defines high numbers as low priority and low numbers as high priority. TASK priorities are controlled by the software (in this case FreeRTOS), and in this case define 0 as lowest and higher numbers have higher priority. Switching between tasks is totally controlled by software (and maybe triggered by an interrupt), and unless they define 1<0, an Idle task priority of 0 will yield to any higher priority task on a call to the task scheduler.

RE: Interrupt priority of idle task.

Posted by Dave on September 5, 2008
You are confusing the task priority with the interrupt priority.

All FreeRTOS tasks, for all architectures, use 0 to be the lowest TASK priority and configMAX_PRIORITIES - 1 to be the highest TASK priority. At priority 0 the idle task is therefore assigned the lowest priority you can assign a task.

Most architectures also use 0 or 1 to be the lowest INTERRUPT priority so the tick interrupt will also be assigned a priority 0 or 1. The cortex does the opposite which is why the text you quote is given. On the Cortex 255 is the lowest priority and 0 is the highest priority. The Cortex ports assign the tick interrupt a priority of 255 so it is the lowest priority interrupt.

The task priority and interrupt priority are two very different things.

RE: Interrupt priority of idle task.

Posted by Bill Yang on September 5, 2008
Thank you, I got it.
Bill Yang

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner