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

Run time stats conditional compilation

Posted by jvalenzuela on October 14, 2011
Just getting FreeRTOS running for the first time and I came across what appears to be a simple problem. If configGENERATE_RUN_TIME_STATS is defined as zero should the call to portCONFIGURE_TIMER_FOR_RUN_TIME_STATS in vTaskStartScheduler be excluded from the build?

Jason Valenzuela

RE: Run time stats conditional compilation

Posted by Richard on October 15, 2011
If configGENERATE_RUN_TIME_STATS is set to one then portCONFIGURE_TIMER_FOR_RUN_TIME_STATS and ( portGET_RUN_TIME_COUNTER_VALUE or portGET_ALT_RUN_TIME_COUNTER_VALUE ) must also be defined. If configGENERATE_RUN_TIME_STATS is set to 0, then the other two macros should not also be defined, although defining them is probably harmless.

The code contains the following sanity check:

#if ( configGENERATE_RUN_TIME_STATS == 1 )

#ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
#error If configGENERATE_RUN_TIME_STATS is defined then portCONFIGURE_TIMER_FOR_RUN_TIME_STATS must also be defined. portCONFIGURE_TIMER_FOR_RUN_TIME_STATS should call a port layer function to setup a peripheral timer/counter that can then be used as the run time counter time base.
#endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */

#ifndef portGET_RUN_TIME_COUNTER_VALUE
#ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
#error If configGENERATE_RUN_TIME_STATS is defined then either portGET_RUN_TIME_COUNTER_VALUE or portALT_GET_RUN_TIME_COUNTER_VALUE must also be defined. See the examples provided and the FreeRTOS web site for more information.
#endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
#endif /* portGET_RUN_TIME_COUNTER_VALUE */

#endif /* configGENERATE_RUN_TIME_STATS */


Regards.

RE: Run time stats conditional compilation

Posted by jvalenzuela on October 17, 2011
Understood. My question stemmed from line 1133 in task.c, which calls portCONFIGURE_TIMER_FOR_RUN_TIME_STATS regardless of the configGENERATE_RUN_TIME_STATS value. This of course fails when configGENERATE_RUN_TIME_STATS is defined to 0 and portCONFIGURE_TIMER_FOR_RUN_TIME_STATS is not defined. I was wondering if the call should be enclosed in an appropriate #ifdef block.

Jason Valenzuela

RE: Run time stats conditional compilation

Posted by MEdwards on October 17, 2011
No #ifdef block is needed. In freertos.h you will find the code below that removes the macro if it is not defined

#ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
#endif


[ 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