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




Loading

taskYIELD_FROM_ISR

Posted by dre on April 24, 2008
Hi,

I'm wondering if there is anyone that has an implementation of the taskYIELD_FROM_ISR for a SAM7X processor (IAR compiler) that they would be willing to share with me.

Also, what happens if I don't yield from isr when the message I just sent unblocks a higher priority task then the one currently running? Will the yield take place at the next tick then?

Thanks,

RE: taskYIELD_FROM_ISR

Posted by Maxim on April 24, 2008
Hi,

I have no implementation of taskYIELD_FROM_ISR for a SAM7X processor, but I'll give you an idea how you can easily implement it on any ARM processor.

To yield from an ISR is a bit problematic because the ISR should return and leave the stack pointer & C.O. in the same state as before entering the ISR.
taskYIELD_FROM_ISR can be realized by raising a software interrupt in VIC. Choosing this implementation you should carefully use nested interrupts if at all. You can even use the same ISR as for the timer interrupt:

__asm void vPortTimerISR(void)
{
portSAVE_CONTEXT

bl [C-function: if not SOFT interrupt -> call vTaskIncrementTick(), else clear SOFT interrupt]
bl vTaskSwitchContext

portRESTORE_CONTEXT
}

To make the context switch a bit faster you can use separate ISRs:
- timer ISR: performs context switch, increments OS tick, clears timer interrupt
- software ISR: performs context switch, clears software interrupt

I hope it will help you

Regards
Maxim

RE: taskYIELD_FROM_ISR

Posted by Richard on April 24, 2008
The macro already exists, its just called something different. See the documentation page for the SAM7S IAR http://www.freertos.org/portsam7iar.html.

portEND_SWITCHING_ISR( ( cContextSwitchRequired ) ), under the interrupt service routine section.

To answer the other question. If you don't call this then the unblocked task will not run immediately once the interrupt has completed, but will get selected to run the next time the RTOS tick occurs.

Regards.

RE: taskYIELD_FROM_ISR

Posted by dre on April 29, 2008
Thanks!!

RE: taskYIELD_FROM_ISR

Posted by Mik Lamming on January 12, 2010
I notice that several of RIchard's excellent examples use task_YIELD_FROM_ISR My appolgies for being so dense but I was unable to find any explanation of the in the manual(s). Given that Richard is so thorough I am assuming I'm looking under the wrong rock :-)

I'm deducing that I need to write an implementation of that macro for any port to a "new" processor - including the ancient AVR mega128. Is that true? And is there some adjacent cast-iron implementation I can model mine upon?

RE: taskYIELD_FROM_ISR

Posted by sotd on January 12, 2010
AVR port can just call taskYIELD() in the interrupt. Most ports must not do this. Look at SIG_UART_RECV in Demo\AVR_ATMega323_WinAVR\serial\serial.c for an example.

RE: taskYIELD_FROM_ISR

Posted by Mik Lamming on January 12, 2010
sotd: thanks mgl


[ 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