Quality RTOS & Embedded Software

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




Loading

Yielding from an ISR

Posted by rafleury on April 23, 2012
How important is it that vPortYieldFromISR() is called at the very end of the ISR handler? For example:

void UART0_IRQHandler(void)
{
Bool woken = false;

someAPICall(&woken);

portyieldfromisr(woken);

}

is this functionally different from:

void UART0_IRQHandler(void)
{
doStuff();
}

void doStuff()
{
Bool woken = false;

someAPICall(&woken);

portyieldfromisr(woken);
}

For refernce im using Rowley Crossworks and the LPC1763.

RE: Yielding from an ISR

Posted by Richard on April 24, 2012
On some ports it is extremely important, essential even, that the yielding is done as the last thing. On the Cortex-M however, it is not important, and either of your code snippets are fine, provided your doStuff() function is only called from an interrupt. If it is not called from an interrupt then it will still be ok provided the function that calls it takes care of the yielding if one is required.

Regards.

RE: Yielding from an ISR

Posted by Frank Andersen on April 24, 2012
Hi Richard,

Could you please explain why the yield not is important on the Cortex-M?

Best regards,

Frank Andersen

RE: Yielding from an ISR

Posted by Richard on April 24, 2012
Every port is different. Some require direct manipulation of the ISR exit code, in which case the yield must be at the end, or use function calls, which again means it has to be at the end, but the Cortex-M just pends the PendSV interrupt, and that can be done at any time because the interrupt won't execute until the original ISR exits (because the PendSV is the lowest priority).


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

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