Introduction to the THREADX Debugger Plugin for the CodeWarrior Debugger

The advanced THREADX RTOS awareness plugin for CodeWarrior is delivered and installed as a part of the CodeWarrior IDE. The plugin facilitates rapid understanding of what is happening in the THREADX application, including information about all application threads and any other application THREADX object.

Start Metrowerks CodeWarrior

To use the plugin, start CodeWarrior and choose Project Options. Select the ColdFire (or other target architecture) Debugger Settings category and choose THREADX from the Target OS support box. Click OK.

Demo Settings

Introduction to the Plugin

The plugin introduces the following elements in the CodeWarrior user interface. In the View menu, it installs a number of entries corresponding to the various types of THREADX-specific windows that can be opened by the plugin. It installs a new menu, named THREADX, with entries for various RTOS-specific commands – in particular, thread-related stepping commands. It installs a new toolbar with buttons for commands from the THREADX menu.


The RTOS plugin introduces seven new debugger windows. Right-clicking in most of the windows opens a context menu where the display format can be set to hexadecimal or decimal. Selecting the Color Changes command highlights all window updates.

The Thread List Window

From the View Processes window, select THREADX.

This window shows a list of all threads created by the current application (by calls to tx_thread_create) and some items pertaining to their current state. The currently active thread is indicated by a state of RUNNING in the State column. The order of the threads is that of the _tx_thread_created_ptr.

You can examine a particular thread by double-clicking on the corresponding row in the window. All debugger windows (Watch, Locals, Register, Call Stack, Source, Disassembly etc.) will then show the state of the program from the point of view of the thread in question. A thread selected in this way is indicated in the Thread window by a different color (for the moment, a subdued blue color).

Selecting a thread from the list will bring up the Threads window, and that Thread’s registers will also be viewable from the View Registers Window.

The THREADX Thread Info display includes a Maximum stack pointer value that shows how much stack has been used thus far.

Note that if a task has been selected by double-clicking, the debugger will show the state of that particular task until another task is selected, even if execution is performed by or in another task. For example, if task A is currently active (RUNNING) and you double-click on task B, which is READY, you will see information about the suspended task B. If you now perform a single-step, the active task (A) will perform a single-step, but since you are focused on task B, not much will actually visibly change.

Inspector Windows

The seven other windows display RTOS status information of various types. These windows are formatted but passive displays of various internal RTOS data structures.





Event Flag Groups

Byte Pools

Block Pools

Thread-Specific Breakpoints

A thread-specific breakpoint can be invoked using the CodeWarrior conditional breakpoint feature. After setting a breakpoint, select View breakpoints and enter the condition in the right hand column, as shown below.

A thread-specific condition can be added to any breakpoint using the THREADX symbol for the current thread or the CodeWarrior-defined keyword “e;mwThreadID“e;.

mwThreadID == 0xXXXXXXXX

where XXXXXXXX is the Thread Control Block (TX_THREAD) address that is displayed with the thread name.

Subscribe to our news