Quality RTOS & Embedded Software

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


Loading

portYIELD() in preemptive mode

Posted by Jeff Smith on October 12, 2005
I'm trying to work out some functions on a board with a port to GCC/HCS12 that is not proven yet. I have been successful with two tasks on different priority, who toggle an LED using vTaskDelay(). I've tested this with either portYIELD() or preemptive mode. It was working after my message
at 2005-08-05 16:35

Now I am apparently stuck on using vApplicationIdleHook(), which may not be execuding, and don't know if I'm using portYIELD() properly.

I use preemptive mode. In a task, priority 1, I have these lines
.while (!(SCISR1 & RDRF))
.portYIELD();

I think this is supposed to mean that on every kernel tick, it would check for the flag above (because it's the highest priority), and then if not flag it would execute the idle hook for the rest of the tick period. Am I wrong? I don't ever see the output I coded in the idle hook.

RE: portYIELD() in preemptive mode

Posted by Nobody/Anonymous on October 12, 2005
portYIELD() forces a context switch, but if the task calling yield is the highest priority task in the system it will run again immediately as you have not asked it to block, therefore the idle task will never execute. Try using vTaskDelay(1) instead. This will block the calling task until the next tick.

RE: portYIELD() in preemptive mode

Posted by Jeff Smith on October 12, 2005
Yeah, thanks. I guess Yield only has a use in the same-priority group (and cooperative mode).

Someday I hope I can follow this scheduler implementation. Funny, having no background in task swapping, I thought it would be more complex than it is. I'm not the type to rely on school or books, so it has been a challenge getting started.


[ 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.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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.


Careers

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

Renesas

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