Runtime statistics problem

Hi. I compiled FreeRTOS to use it on my STM32F401 microcontroller. I created two tasks. Each of these tasks is just toggling a LED on the board. This is working as expected. Then, I enabled the runtime statistics configuration. I initialized some timer and added the necessary defines. Measuring the execution time of the tasks seems to work. I implemented a third task which is just printing the collected stats every 5s on the serial line. And here is the problem: Everything is fine if I create the tasks in the follwing order (first the printing task, and afterwards the two LED toggle tasks): ~~~ xTaskCreate(printStatsTask, “STATS”, configMINIMALSTACKSIZE, NULL, STATSTASKPRIORITY, (TaskHandlet *) NULL); xTaskCreate(ledFlashTask0, “LED0”, configMINIMALSTACKSIZE, NULL, LEDTASKPRIORITY, (TaskHandlet *) NULL); xTaskCreate(ledFlashTask1, “LED1”, configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIORITY, (TaskHandle_t *) NULL); ~~~ If I reorder the task creation the following way (first the two LED tasks and the last task is the printing task) the output of the statistics is wrong: ~~~ xTaskCreate(ledFlashTask0, “LED0”, configMINIMALSTACKSIZE, NULL, LEDTASKPRIORITY, (TaskHandlet *) NULL); xTaskCreate(ledFlashTask1, “LED1”, configMINIMALSTACKSIZE, NULL, LEDTASKPRIORITY, (TaskHandlet *) NULL); xTaskCreate(printStatsTask, “STATS”, configMINIMAL_STACK_SIZE, NULL, STATS_TASK_PRIORITY, (TaskHandle_t *) NULL); ~~~ I’m getting a totally wrong number for the “LED1” task: ~~~ STATS 8056 <1% LED1 536892724 13176% IDLE 3029639 74% LED0 334500 8% Tmr Svc 65536 1% ~~~ Can someone tell me what’s the reason for that? It is totally strange for me. Thanks, Andreas

Runtime statistics problem

What are the task priorities?

Runtime statistics problem

Task priorities are the same for all 3 tasks: tskIDLE_PRIORITY + 1