Cortex-M ITM Module: Modern approach to printf() debugging


Printf() debugging is an easy way to get an insight into an embedded application.


Old school vs Modern

In the olden days a well-known technique was printf() output for event tracing from embedded applications. This is based on the UART interface connected to a PC and snooped by the Terminal application running on the PC. This method requires a free UART port and an operational hardware and software application.

A much better alternative on modern Cortex-M devices is implementing printf() output using the Instrumentation Trace Macrocell (ITM) module provided by the Cortex-M core.


How does ITM module make a difference?

The ITM method is much faster compared to the UART based since writing to the UART takes much longer and has also a higher impact on system performance.

By using the Cortex-M ITM, the application can “print” optional user data to iSYSTEM winIDEA Terminal window. Users can instrument their code with “trace points”, which provide insight into the embedded target behavior at full MCU speed and without stopping the execution.

cpu load utilization calculation idle active time


Generating trace messages with “Trace points”

“Trace points” are basically printf() statements. Each statement writes a user defined data to the ITM stimulus register(s). Each write to these registers generates a trace message, which is then sent out to the SWO (Single Wire Output) trace port, where iSYSTEM BlueBox captures and decodes it, and then displays a human readable string in the Terminal window.

Writing data within the application “trace point” requires a single write cycle to the internal 32-bit register which yields negligible performance penalty. For this reason the same software can also be used for the development and in the final release.


How to start?

Simply follow our ARM Cortex-M Instrumentation Trace step-by-step tutorial and you will be able to:

  • Create winIDEA configuration
  • Add Trace points to your code
  • Observe embedded system behavior in the Terminal window

Bonus for advanced users: step-by-step instructions for Function and Data Profiling of an AUTOSAR based embedded application.


Need more information?

Request a demonstration at