Hello,
Does anyone know of anyway to get a list of all 'registered' (i.e. created) tasks in RTX? I mean in code during runtime, of course.
(Note: I think it must be possible since uVision does it?)
Thanks in advance.
M
I think it must be possible since uVision does it?
You're vastly underestimating how much more information uVision has about a running program than the CPU running it does. No, just because uVision can do it by no means implies that the code itself can do it. For starters, it's quite extremely unlikely that the names of tasks even exist anywhere in the code memory.
I do not think I'm vastly underestimating anything.
I do not need the string names of the tasks - (almost) everything else I would argue must come from the RTOS.(or at a minimum known by the RTOS - stack size, current stack pointer, tasks state... I'm pretty sure this would just be the context save of any RTOS)
More precisely all I need is a list of all tasks (IDs would be fine) Of course the CPU knows this as that is the point of an OS.
So can anyone help me with this challenge? Is there any way with the current API to get a list of all 'registered' tasks? If the API does not provide such a way can anyone think of a cleaver scheduler hack?
Maybe overriding the task create functions? Has anyone ever done this?
Try prying in the sources of RTX, namely in the parts where tasks are created. I am sure you'll find you answer (container) there.
Thanks Tamir. I checked it out and it looks like the OS keeps 2 linked lists (read and delayed tasks in rt_list.c) I don't see any API to access these lists so I don't think I will use these directly.
Anyway, without a documented feature I think I will find another solution to my problem.
Thanks.
Look in RTX_lib.c
It contains a declartion for mp_tcb. This is the list of Task Control blocks.
*os_active_TCB is an array of active task pointers.
RTL.h includes a definition of *P_TCB (the structure of what a TCB item looks like)
You should be able to get what you need from these.
Hi Robert,
Thanks you, that looks interesting.
Do you work for Keil? My concern in using a non-documented feature is that it may disappear in a planned future upgrade.
Regards,
View all questions in Keil forum