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.
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: https://sourceforge.net/p/freertos/code/HEAD/tree/tags/V9.0.0/FreeRTOS/Demo/CORTEXA9Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h 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). Regards.
Thanks for the input – it was very helpful. I figured there were examples to look at, I just didn’t know where to look. Regards
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.