I’m looking for a way to cycle through all tasks retrieving information such as task handle, task name, etc. I know about uxTaskGetSystemState() and vTaskList() but having quite a few tasks and not really much memory for debugging, something like this would be great:
tsk = FirstTask();
name = pcTaskGetName(tsk);
/* and other things with this task */
while (tsk = NextTask());
But there is no such thing as FirstTask() and NextTask(). uxTaskGetNumberOfTasks() however exists. Is there a possibility to do the above without writing code to first create a list of existing task handles?
many thanks, Felix
No, but you could copy the implementation of uxTaskGetSystemState(), which cycles through all tasks in all lists, to do the same but looking in one list at a time. That could be done by exposing prvListTasksWithinSingleList(), which is currently a file scope function. Alternatively place your implementation in a freertos_task_c_additions.h header file so you can leave prvListTasksWithinSingleList() private to avoid editing the kernel code.
Many thanks for your response. Once I figure out how uxTaskGetSystemState() works it is probably best to implement my code in an external freertos_tasks_c_additions.h file. The main work to be done is write some code that gets all task handles one after the other using minimal resources.