Debugging is usually a ‘stop-inspect-continue’ process. That does not work very well for watching a system which continuously changes its state. For this usually I toggle an LED, or write things to the console to watch with a human eye what is going on. But there is something very powerful in the CodeWarrior debugger too: to display variables and memory content while the target is running.
The feature works with memory and (global) variables. For example I have a global ‘cnt’ counter variable which counts up and down depending on my system state:
Eclipse only shows me that variable while I’m in its implementation module. In order to have it visible all the time, I add it to the Global Variables:
Next I select the variable and press OK:
Now if I run my application, that variable is always visible:
Enable Live View
But: the variable value is ‘frozen’ while the debugger is running. I need to stop it to see the new value. To enable the ‘Live View’ to have it updated regularly while the debugger is running, I need to enable the ‘Refresh While Running’ option:
Now the variable content is constantly refreshed while running:
❗ What happens is: the debugger reads periodically from the target. While this is using ‘free’ cycles (e.g. on BDM), and does not stop the target, this still might be somewhat intrusive. This means: it will impact the execution speed on the target. So be careful about adding too much to watch this way. The other thing is: the feature depends heavily on the speed of the debug connection: While it works with OSBM/OSJAG/OpenSDA, it is really slow. It works better with a faster connection like Segger or P&E USB Multilink.
Live View for Memory
The same thing works for the Memory View where I can enable the ‘Live View’ or ‘Refresh While Running’ mode:
❗ Be aware that for the memory the debugger has to read data, so here you need a fast debug connection. Additionally it seems that the debugger needs to read a whole bunch of memory as I cannot just read a single or set of memory address (I could use a constant pointer instead in the Variables view). As such, Live View in the memory view is really slow, at least with OSBDM/OSJTAG/OpenSDA. Up to the point it is not really useful at all for Memory.
Now the question is: how to configure the refresh period? There is a setting or this in the debug/launch configuration:
That feature helps me to watch directly with the debugger variables. It is understood that things are intrusive, and depends on the connection speed (another good reason to invest a few $ into a good BDM/JTAG wiggler and not rely on OpenSDA/OSBDM/OSJTAG only).
If used wisely (few variables, reasonable refresh time), this feature is very useful for me.
Happy Viewing 🙂