Debugging Synergy Applications: Visualizing Variables and Data

Debugging an embedded system can sometimes be really tough, especially if that system is a real-time system that cannot be halted. There are many methods that can be used to trace application data but two simple and easy to setup techniques are built right into e2 studio; the Real-time chart and the Visual Expression tool. In this post, we will explore how to use these tools and a few common pitfalls that should save developers time and minimize head scratching.

The first tool that we will discuss is the Visual Expression tool. Visual Expression provides developers with graphical gauges, dials and indicators to interact and explore their application behavior. For example, a developer can use a gauge or a meter to watch a variable value and make sure that it remains within a specified range. A label can be used to view an enum state such as our trusted level variable that is defined in the default blinky_led_entry function. There are also controllers such as dials and sliders that can be used to modify critical values and tune a systems behavior.

In order to use a gauge, controller or indicator, a developer simply needs to open the Visual Expression tool by clicking Renesas Views -> Debug -> Visual Expression. A developer then can drag the tool that they want to use onto the grid (or white canvas depending on the current settings). Right clicking on the object will reveal a menu that provides options such as:

  • Delete
  • Set expression
  • Set expression value
  • Clear expression
  • Set color
  • Properties

The most important option here is “Set expression”. This allows a developer to assign a variable such as counter or level. The expression value will then be linked to the visualization aid. The properties option allows the developer to adjust the range that is displayed.

The second tool that can be used to display data in real-time is the Real-time Chart. The Real-Time chart can be found under Renesas Views -> Debugging -> Real-time Chart. The Real-time Chart allows a developer to plot multiple variables simultaneous and see how they change over time. A simple example can be seen below:

When using the Real-Time Chart, the best thing to do when setting up an expression is to check the area box which will shade the chart below the data. This makes it easier to view the graph since the latest data is plotted on the left and not on the right.

When setting up an expression for the Visual Expression tool or the Real-time Chart, it’s important that a developer follow a few best practices:

  • The variable to be monitored must exist at the file scope level and not have been defined within a function. This will cause the variable to go out of scope and be unavailable for visualization.
  • Enum datatypes can only be displayed using a label. Trying to graph a variable such as the level variable in blinkyLED will result in a graph or gauge not being updated.

When these best practices are followed, you’ll notice in the image below that gauges and labels do NOT have (unavailable) displayed next to them like in the first but instead are displaying the current variable values.

In the next post, we will explore RTOS Aware debugging and how we can perform a worst-case stack analysis on our RTOS based applications without having to do any heavy lifting.

 

Until next time,

 

Live long and profit!

 

Professor_IoT

 

Hot Tip of the Week: Did you know that older versions of SSP and the related documentation is available on the Synergy Gallery? Simply select the Release Archive tab on the far-right side of the SSP Gallery Page. You will find all the previous Release names, Version, Release Date, Supported MCU Groups and Documentation. Click on the blue down arrow under the Version column to access the download files for the release.