Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


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 ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists