Quality RTOS & Embedded Software

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



Posted by lee-soter on June 7, 2016

According to the documentation that I have read regarding getting task stats I should be able to turn on configGENERATERUNTIMESTATS. A prerequisite for the function is portCONFIGURETIMERFORRUNTIMESTATS the only problem I cannot find the definition for this variable anywhere. I have set configUSETRACEFACILITY

I want to use this tool to help troubleshoot a problem I am having in my system_tasks.c file. I have 5 or 6 task that I am trying to start - I appear to only be able to start two and the third one fails and calls the function vApplicationMallocFailedHook. I have tried shotgunning the problem by doubling the heap but now I need to see what is going on. The Microchip debugger only gets me so far; I would really like to get this software tool working

I saw a similar message from 2011 but the solution looked unclean and was hoping that there was a better solution.

Any help would be greatly appreciated.

I am using MPLAB X v3.3 Harmony 1.07.01. XC32 v1.4 Hardware is my own design and I have built some basic code to veryify the hardware is working correctly.


Posted by rtel on June 7, 2016

portCONFIGURETIMERFORRUNTIME_STATS is not a variable, but a macro that you have to provide yourself.

As per the documentation page for run time stats (http://www.freertos.org/rtos-run-time-stats.html), to use the facility you need to provide three macros. You already have configGENERATERUNTIMESTATS set to 1, which means you then have to provide portCONFIGURETIMERFORRUNTIMESTATS() which must configure the clock used as the run time stats time base, and portGETRUNTIMECOUNTERVALUE() which much return the current value of whichever clock you are using.

You will find lots of examples by grep-ing portCONFIGURETIMERFORRUNTIME_STATS in the FreeRTOSConfig.h files found in the many sub-directories of FreeRTOS/Demo in the main FreeRTOS.org download. Here is one example:


Where you will find that portCONFIGURETIMERFORRUNTIMESTATS() calls vInitialiseTimerForRunTimeStats() (which is a function implemented in the projects main.c source file), and portGETRUNTIMECOUNTER_VALUE() is implemented to directly access a timer counter register (with some bit manipulation as it is a down counter).



Posted by lee-soter on June 7, 2016

Thanks for the input - it was very helpful. I figured there were examples to look at, I just didn't know where to look.


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

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.


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


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