Quality RTOS & Embedded Software

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


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