Keil™, An ARM® Company

Technical Support

ARTX: DETERMINE THE CURRENT RUNNING TASK


Information in this article applies to:

  • ARTX-ARM All Versions
  • ARTX-166 All Versions

QUESTION

Is there an easy wait to determine (or protocol) the current running task in Advanced RTX?

ANSWER

The debugging dialog that is available in µVision under Peripherals - Advanced RTX displays the current running task.

In other debugging tools you may examine the content of the Task Control Block (TCB). Advanced RTX provides the variable os_runtask which is a pointer to the TCB of the current running task. You may display the struct based on os_runtask.

In ARTX-166 the TCB contains the task id. This is the task identifier used in the task definition. (See definition of struct OS_TCB in AR166_Config.h).

In ARTX-ARM the TCB contains directly the task entry address ptask. (See definition of struct OS_TCB in ARARM_Config.h).

You may also write these variables to a special debug output port whenever a task is marked as RUNNING. The task switching is performed in the configuration file AR166_Config.c (for ARTX-166) or ARTX_Config.c (for ARTX-ARM). There are two functions that mark a task as running:

os_clock_TCB.state = RUNNING;

and

p_new->state = RUNNING;

You need to insert a protocol function for the debugger before the source line that logs the task id or task function address ptask.

For example:

os_clock_TCB.state = RUNNING;
debug_log (os_clock_TCB.id);

and

p_new->state = RUNNING;
debug_log (p_new->id);

Last Reviewed: Monday, May 09, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure