Quality RTOS & Embedded Software

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




Loading

taskYIELD fromTickHook

Posted by Nobody/Anonymous on September 7, 2006
Is any restrictions calling taskYIELD from TickHook?

freertos version v4.1.0
ATMEGA GCC port

>>-This code is working->>
SIGNAL( SIG_OVERFLOW0 )
{
portBASE_TYPE xTaskWoken = pdFALSE;
TCNT0 = 125;
TmrTickCtr++;
if (TmrTickCtr >= TMR_DLY_TICKS)
{
TmrTickCtr = 0;
xTaskWoken = xSemaphoreGiveFromISR( TmrSemTenths, xTaskWoken );
}
if( xTaskWoken != pdFALSE )
{
taskYIELD ();
}
}

>>-but this code not->>

void vApplicationTickHook( void )
{
portBASE_TYPE xTaskWoken = pdFALSE;
TmrTickCtr++;
if (TmrTickCtr >= TMR_DLY_TICKS)
{
TmrTickCtr = 0;
xTaskWoken = xSemaphoreGiveFromISR( TmrSemTenths, xTaskWoken );
}
if( xTaskWoken != pdFALSE )
{
taskYIELD ();
}
}
stack underflow at vPortYieldFromTick()

RE: taskYIELD fromTickHook

Posted by Nobody/Anonymous on September 7, 2006
Yes there are restriction - on most ports this is definitely not a good idea. In fact calling yield from any isr is not a good idea unless you use the macros provided in portmacro.h to do so, and follow the examples in the demos.

The actual answer is dependent on the port you are using. Each port yields in a different way.

In most cases yielding from the tick hook will not actually perform any useful function. This is because the tick hook is called prior to the yield being performed by the tick itself. Therefore if you hook wakes a task, then the tick code itself will yield if the woken task has a higher priority than the task that was interrupted.


[ 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