Quality RTOS & Embedded Software

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


Loading

FreeRTOS Round Robin

Posted by cdb1702 on December 7, 2015

What are ,in the source code of FreeRTOS.the functions that make the round robin in the case of tasks with the same priority? The following example is taken from USING THE FREERTOS REAL TIME KERNEL A Practical Guide Richard Barry void vTaskFunction( void pvParameters ) { char *pcTaskName; volatile unsigned long ul; / The string to print out is passed in via the parameter. Cast this to a character pointer. / pcTaskName = ( char * ) pvParameters; / As per most tasks, this task is implemented in an infinite loop. / for( ;; ) { / Print out the name of this task. / vPrintString( pcTaskName ); / Delay for a period. / for( ul = 0; ul < mainDELAYLOOPCOUNT; ul++ ) { / This loop is just a very crude delay implementation. There is nothing to do in here. Later exercises will replace this crude loop with a proper delay/sleep function. / } } } / Define the strings that will be passed in as the task parameters. These are defined const and not on the stack to ensure they remain valid when the tasks are executing. / static const char *pcTextForTask1 = “Task 1 is runningrn”; static const char *pcTextForTask2 = “Task 2 is runningtn”; int main( void ) { / Create one of the two tasks. / xTaskCreate( vTaskFunction, / Pointer to the function that implements the task. / "Task 1", / Text name for the task. This is to facilitate debugging only. / 1000, / Stack depth - most small microcontrollers will use much less stack than this. / (void)pcTextForTask1, /* Pass the text to be printed into the task using the task parameter. / 1, / This task will run at priority 1. / NULL ); / We are not using the task handle. / / Create the other task in exactly the same way. Note this time that multiple tasks are being created from the SAME task implementation (vTaskFunction). Only the value passed in the parameter is different. Two instances of the same task are being created. / xTaskCreate( vTaskFunction, "Task 2", 1000, (void)pcTextForTask2, 1, NULL ); /* Start the scheduler so our tasks start executing. / vTaskStartScheduler(); / If all is well then main() will never reach here as the scheduler will now be running the tasks. If main() does reach here then it is likely that there was insufficient heap memory available for the idle task to be created. CHAPTER 5 provides more information on memory management. */ for( ;; ); }


FreeRTOS Round Robin

Posted by rtel on December 7, 2015

Search for

#if ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) )

in this file

https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/tasks.c#l2091

to see the souce lines.


FreeRTOS Round Robin

Posted by cdb1702 on December 9, 2015

Thank you Carlo De Bonis


FreeRTOS Round Robin

Posted by cdb1702 on December 9, 2015

I am using FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. and in this version there is not the funnction BaseTypet xTaskIncrementTick( void ) nor is this the definition of configUSETIME_SLICING but the example taken from USING THE FREERTOS REAL TIME KERNEL A Practical Guide it is earlier


[ 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