Keil Logo

µVISION DEBUGGER: After Disabling Trace, RTX Hangs in Loop


Information in this knowledgebase article applies to:

  • MDK-ARM v5
  • STMicroelectronics Devices
  • CMSIS RTOS RTX

SYMPTOM

After disabling a trace in Options for Target => Debug tab => Settings => Trace tab, and removing an optional call to trace setup function in initialization file, the program execution stays in a while loop inside one of the following functions:

 void dbg_task_notify (P_TCB p_tcb, BOOL create) {
  while (ITM_PORT31_U32 == 0U);
  ITM_PORT31_U32 = (U32)p_tcb->ptask;
  while (ITM_PORT31_U32 == 0U);
  ITM_PORT31_U16 = (U16)((create << 8) | p_tcb->task_id);
}


 void dbg_task_switch (U32 task_id) {
  while (ITM_PORT31_U32 == 0U);
  ITM_PORT31_U8 = (U8)task_id;
}

CAUSE

TRACE_IOEN (in System Viewer's DBG dialog, DBGMCU_CR section) was set to zero. But other registers related to trace remain enabled. When debug functions are called, a non-zero value is expected from ITM Stimulus Port 31, but this condition is never satisfied.

RESOLUTION

Disable trace in the core registers using an initialization file, modifying TPIU registers in the debug window, or by power-cycling the board to return device back to original state (no trace). If the debug session should remain open, then re-enable trace in the debug adapter from the Debug => Debug Settings => Trace tab and re-enter initialization file's trace setup function from µVision's Command window, for example, entering "TraceSetup();".

To avoid issue in the future, modify ITM Trace Privilege Register to allow access to a group of stimulus ports in user mode. This can be done in target driver setup's ITM Stimulus Port section. The leftmost box (Port 31..24) should be enabled on the Privilege: line; use the picture in the link as an example.

MORE INFORMATION

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Thursday, August 23, 2018


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.