ARM Technical Support Knowledge Articles


Applies to: Advanced RTOS


Information in this article applies to:


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


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;


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 (;


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

Article last edited on: 2005-05-09 17:15:35

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential