Real-time "live" variable watch on Cortex-M processors [debugger tips]

Posted by Magnus Unemyr on Jul 28, 2015 11:38:00 AM

ARM Cortex-M processors like STM32, Kinetis or EFM32 support live variable watch, a debugger feature that update the variables in a watch view in (almost) real-time as the target system executes at full speed. This feature is incredibly useful and can quickly help identify many bugs. Still, it appears many Cortex-M developers are not aware of this important debug capability.

I wrote another blog post on this topic some months ago, but I keep getting questions on the subject so I will cover live "real-time" variable watch once more. I would argue this capability is so useful and important, that professional embedded developers should not use an IDE without this ability. Let’s see how live variable watch debugger windows can be useful.


Often it is not very helpful to stop the execution on a breakpoint to query the target system variable values. Perhaps because you don’t want to debug the code in the first place. Maybe you run the embedded system during field tests or in the lab, and the target system reads and processes live sensor data. You don’t want to debug the software, but rather just “look inside” to see what is going on as the system performs its regular duties. In this situation, wouldn’t it be great to see how the variable values change in real-time right from within the debugger?

Another scenario is when your embedded product has moving parts, and you want to read the axis positions as a machine turns or moves. Or you are in the metering or industrial control business, continuously reading values from various sensors as they are processed. In situations like these, it is useful to read and display variable values live when the target runs at full speed.

Atollic TrueSTUDIO has a “Live Expressions” view in the debugger perspective, providing developers with this capability. TrueSTUDIO not only show an unlimited number of variables with live update but can also compute and display the result of complex mathematical expressions in “real-time” as well. The Live Expressions view supports structures and array elements for a full, “at-a-glance” visualization of complex data structures too.

If you are using a Cortex-M processor like STM32, Kinetis, LPC or EFM32, and you use the Atollic TrueSTUDIO IDE with a SEGGER J-Link JTAG probe, you may want to try this capability. While this is a very useful tool in your debugging toolbox, it is also a very useful for system-level testing and customer demos during prototyping or early development phases.

This capability is not supported with all JTAG probes, however. In case you are using the ST-LINK JTAG probe instead of SEGGER J-Link, you can use the Serial Wire Viewer (SWV) data trace interface to achieve a similar capability. To read more on event- and data- tracing using SWV/SWO on ARM Cortex-M devices, read this whitepaper:

Read our SWV event and data tracing whitepaper!


ARM Development White Paper - TrueSTUDIO


Topics: ARM Cortex, Debugging, Atollic TrueSTUDIO, SEGGER J-Link, ST-LINK