Quality RTOS & Embedded Software

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


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