This blog article will extend upon this and show how you can visualize variable values graphically in real-time, using an “oscilloscope style” data plot graph as the Cortex-M target system executes at full speed.This gives developers instant and highly visual feedback, non-intrusively, from running target systems.

To produce a graphical data plot of variables in real-time, Serial Wire Viewer tracing is setup in the same way to monitor 1-4 variables using the SWV comparators as outlined in my blog article on real-time variable watch. I that article, I used the Atollic TrueSTUDIO C/C++ IDE “SWV Data Trace” view to display variable values in real-time as the target system runs at full speed:

With the SWV data trace comparators setup in the same way (just ensure SWV trace package timestamps are enabled in the SWV configuration dialog box), open the “SWV DataTrace Timeline Graph” view in the Atollic TrueSTUDIO IDE:

This view show the variable values graphically in real-time as the target system executes at full speed, and the graph scrolls automatically to the left in an animated manner as execution fills the timespan of the graph. Visualizing variable values in this way is highly useful, in particular in these situations:

Values are expected to follow a certain pattern. It is very easy to see if the pattern is broken.

It is easy to see how different variable values correlate to each other over time

The view also permits zooming and panning in the graph, and saving “screenshots” of the graph to image files too.

One particular strength of the Serial Wire Viewer (SWV/SWO) data tracing in the Cortex-M core is that all changes to a variable is detected; it is not polled periodically with a high risk the variable can take other values between the polls. With SWV, all changes to the variable are detected, providing a fully correct picture of what happens (the only exception is buffer overflows if too much SWV trace packages are sent to the debugger, but that is easily detected in such case).

By using SWV tracing in Cortex-M devices like STM32, Kinetis, LPC etc., ARM developers can leverage very powerful debugging capabilities. In particular the SWV data tracing capabilities, including the oscilloscope styled real-time graphs outlined in this article, are very useful and ought to be considered by any Cortex-M developer.

SWV tracing is a great capability of the Cortex-M core; but it is normally not supported by Eclipse IDE’s and the GNU gcc/gdb tools. The Atollic TrueSTUDIO IDE, which is based on Eclipse and the GNU tools, do however support SWV fully due to proprietary extensions. The SWV tracing support in Atollic TrueSTUDIO works with both SEGGER J-Link and ST-LINK debugger probes.

You can read more on advanced Cortex-M debugging using SWV event- and data tracing in this whitepaper: