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


Bug fix - runtime statistics collection

Posted by Philip Pemberton on August 14, 2013

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();

With this:

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


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):


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.


[ 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