1
votes

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

2

2 Answers

1
votes

First thing to do is determine if the problem is in the debugger plug in (I'm not sure which one this is) or in the build. To do that place a breakpoint in xTaskIncrementTick() inside tasks.c, then view the pxCurrentTCB variable, which is a pointer to a TCB structure. If run time stats are enabled then there should be a structure member called ulRunTimeCounter. Is that structure member there? If so, does it contain a value? Even if the value is wrong, if it is there, it would seem to indicate that the issue is in the debugger plug-in.

1
votes

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