eclipsedebuggingstm32freertos

How to show runtime in FreeRTOS Task List during debugging


I'm working on an embedded software project (ARM Cortex-M7, STM32F7 microcontroller) with System Workbench for STM32, which is an Eclipse-based IDE. I've installed the "FreeRTOS Task Aware Debugger for GDB" from NXP Kinetis Design Studio (KDS)1. I want to see the runtime of each task, which should be possible with FreeRTOS and this plugin. Unfortunately, in the task list the runtime is not displayed. Instead it shows the following warning message (see also screenshot):

Enable "configGENERATE_RUN_TIME_STATS" macro in FreeRTOSconfig.h to see "Runtime".

screenshot

However, I've already enabled the specified macro and other necessary macro's in FreeRTOSconfig.h:

#define configGENERATE_RUN_TIME_STATS            1

/* Definitions needed when configGENERATE_RUN_TIME_STATS is on */
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS configureTimerForRunTimeStats
#define portGET_RUN_TIME_COUNTER_VALUE getRunTimeCounterValue

Why does the plugin mention that this macro needs to be enabled when it is already enabled? What should I do to see the runtime in the Task List during debugging?


1 Eclipse update-site: http://freescale.com/lgfiles/updates/Eclipse/KDS


Solution

  • According to this post the solution is to

    #define portREMOVE_STATIC_QUALIFIER 1
    

    This makes sense, since the FreeRTOS source code (tasks.c) contains the following comment:

    /*
     * Some kernel aware debuggers require the data the debugger needs access to be
     * global, rather than file scope.
     */
    #ifdef portREMOVE_STATIC_QUALIFIER
        #define static
    #endif
    

    and in that same file the relevant variables are indeed defined as static:

    #if ( configGENERATE_RUN_TIME_STATS == 1 )
        PRIVILEGED_DATA static uint32_t ulTaskSwitchedInTime = 0UL;
        PRIVILEGED_DATA static uint32_t ulTotalRunTime = 0UL;
    #endif