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

idleTask - utilization

Posted by Martin Velek on November 18, 2008
Hi,

is there a different method to measure time (with logic analyzer, pin L/H) how long FRTOS stays in the idleTask?

I have tried trace macros
traceTASK_SWITCHED_IN() \
if (0 == strcmp(pxCurrentTCB->pcTaskName, "IDLE")) ....

traceTASK_SWITCHED_OUT() \
if (0 == strcmp(pxCurrentTCB->pcTaskName, "IDLE")) ....

but it is a little uncomfortably to compare 5 bytes and call library function.

Thanks
Martin


RE: idleTask - utilization

Posted by Dave on November 18, 2008
The idle task is automatically created when the scheduler is started. If you create all your tasks before the scheduler starts, and never delete any tasks, then you can use

traceTASK_SWITCHED_IN() \
if( (uxCurrentNumberOfTasks - 1) == pxCurrentTCB->uxTCBNumber )


but configUSE_TRACE_FACILITY must be set to 1.

Another way is to store a handle to the idle. Assuming you store this in a variable called xIdleTaskHandle then you can do

traceTASK_SWITCHED_IN() \
if( pxCurrentTCB == xIdleTaskHandle )



RE: idleTask - utilization

Posted by Martin Velek on November 18, 2008
Yes,

the first solution seems fine.

How to store xIdleTaskHandle? In vTaskStartScheduler() is called xTaskCreate( prvIdleTask, ( signed portCHAR * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL ); so I think that I should create vApplicationIdleHook(), call xTaskGetCurrentTaskHandle() in it and store to global variable?

Thank You

Martin

RE: idleTask - utilization

Posted by Dave on November 18, 2008
That would work, but you could just edit the call to

xTaskCreate( prvIdleTask, ( signed portCHAR * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL );

as

xTaskCreate( prvIdleTask, ( signed portCHAR * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, &xIdleTaskHandle );

just the last parameter is different.

RE: idleTask - utilization

Posted by Martin Velek on November 18, 2008
Ok, I only wanted to avoid editing source code of FT(task.c).

Many thanks that you noticed configUSE_TRACE_FACILITY option. I was confused, why it don't work before reading third paragraph :).

Martin


[ 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