Quality RTOS & Embedded Software

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




Loading

Bug fix - runtime statistics collection

Posted by Philip Pemberton on August 14, 2013
Hi,

There appears to be a bug in FreeRTOS 7.5.2's tasks.c.

If a FreeRTOS application enables runtime statistics and defines the portALT_GET_RUN_TIME_COUNTER_VALUE macro but does not provide the portGET_RUN_TIME_COUNTER_VALUE function, tasks.c will fail to link (or possibly fail to compile at all, depending on compiler warning/error promotion options).

To fix this, replace the following code block in tasks.c:


#if ( configGENERATE_RUN_TIME_STATS == 1)
{
if( pulTotalRunTime != NULL )
{
*pulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();
}
}
#else


With this:


#if ( configGENERATE_RUN_TIME_STATS == 1)
{
if( pulTotalRunTime != NULL )
{
#ifdef portALT_GET_RUN_TIME_COUNTER_VALUE
portALT_GET_RUN_TIME_COUNTER_VALUE( *pulTotalRunTime );
#else
*pulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();
#endif
}
}
#else


Thanks,
Phil.

RE: Bug fix - runtime statistics collection

Posted by Philip Pemberton on August 14, 2013
Just had a dig through SVN. Looks like this was introduced in rev 1960 (FreeRTOS 7.4.2 probably didn't have this bug, but 7.5.0 certainly did):

http://freertos.svn.sourceforge.net/viewvc/freertos/trunk/FreeRTOS/Source/tasks.c?r1=1959&r2=1960&

The proverbial "smoking gun" is at Line 1489. Note that rev 1959 contains an ifdef to check whether the portALT_GET_RUN_TIME_COUNTER_VALUE macro is declared and uses the aforementioned macro if it is. Failing that, it falls back to using portGET_RUN_TIME_COUNTER_VALUE. The replacement code on the right (line 1491 onwards) does not contain this ifdef and thus introduces a bug.

RE: Bug fix - runtime statistics collection

Posted by Richard on August 14, 2013
Thank you for taking the time to report this.

I have committed the fix to SVN and added a note with a link to the fix in the "known issues" list.

Regards.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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