Make runtime stats working with compiler optimization enabled

Hi forums,

I’m currently on profiling a FreeRTOS application and it’s my first time to use the run-time statistics feature of FreeRTOS together with the Eclipse “FreeRTOS Task List” view.

When switching on compiler optimization (above -O0), the runtime stats vanish. A workaround is described at the end of this blog post on Atollic and FreeRTOS:

To solve the issue sustainably, I would recommend to declare ulTotalRunTime = 0UL in tasks.c as volatile.

The second suggestion of the blog post, to disable optimization for tasks.c completely, affects performance too much.

Is it worth to raise an issue for that on GitHub?


Please just create a pull request on Github with the volatile added - thanks.