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

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