Tools – A First Encounter with the SEGGER J-Trace

Finally! I have a J-Trace in hand and I am ready to wreak havoc on those pesky software bugs that always toy with me! A little more than a year ago I decided that I couldn’t stand using low-cost, one-off debuggers any longer and needed to invest in a real debugging tool that I could not only use across multiple microcontroller families but also had all the features I would ever need in a professional debug probe. After careful review and consideration I had narrowed the decision down to the J-Link Ultra+ ($795) and the J-Trace ($1895). At the time, comparing the extra cost and features, I decided that I didn’t really need the trace capability and the extras that came with the J-Trace so I went for the J-Link Ultra+.

I quickly discovered that the J-Link Ultra+ was excellent and that it was the debug probe I should have purchased years ago. After several months of use though, I started to yearn for instruction tracing, streaming trace, ethernet and the ETM interface. I realized that when I made my purchasing decision, I had allowed cost to dominate the decision and I didn’t account for time that could be saved debugging and understanding my embedded systems let alone the verification data that could be gleaned. After a long and patient wait, it’s time to dive in and see what the J-Trace is really capable of!

After unboxing the J-Trace, I was pleased to discover that SEGGER had thoroughly thought through the unboxing process and provided an easy to follow, step-by-step tutorial for getting the tools and included test board setup. The setup process was simple:

  1. Connect the J-Trace to the computer
  2. Connect the ETM cable to the test board
  3. Power up the test board
  4. Download and install the J-Link software package (which I already had)
  5. Download the test application
  6. Download and install Ozone
  7. Run the test application

The cool part about running the test application with Ozone was that there was no need to setup and compile a toolchain. The test application already came prebuilt (although source code and project was included) along with the debugger setup files. Ozone is a stand-alone debugging application that a developer is able to use to perform various activities such as

  • instruction tracing
  • trace profiling
  • data export
  • deep insight analysis

After firing up the example application in Ozone and letting it run for a bit, my environment looked as follows:

There are a lot of insights to be gained from data gathered. For example, a developer can look more closely at the instruction trace that shows not just the instructions executed but also the lines of code that they are associated. An example can be seen below:

Next, a developer can view the code coverage. The code coverage window provides a developer not just with how much of the source is covered but also the total instruction coverage as well. The data is broken up by function and even provides how many times the functions were executed. It even provides the CPU load that each function is using! An example can be seen below:

I quickly discovered that the data in these windows could be exported in either a report format or a .csv. The report is human readable and useful to get a general feel for how testing might have gone or how the system was behaving. The .csv report is a great format to use for further analysis or even to demonstrate that the system was tested and verified.

The last trick I noticed within Ozone was that when running an application, a developer could visually see how the code was being executed. The margins in the code area next to each line of code would change color based on whether none of the code, some of the code or all of the code had been executed. Right clicking and selecting execution count even displays how many times a particular lien of code was executed as shown below:

So far I’ve only scratched the surface on what the J-Trace can do. I’m excited at the possibilities and digging deep to discover the tips, tricks and techniques that will help embedded system developers create more robust systems and decrease development costs.

If you are interested in learning more about tracing and how to debug real-time embedded systems, consider joining me for my free webinar on “Verifying RTOS Applications using Deep Insight Analysis” on Wednesday September 27th, 2017.


Share >

2 thoughts on “Tools – A First Encounter with the SEGGER J-Trace

    • Thanks for the comment. I don’t believe that J-Trace supports power/energy profiling. A quick look at the toolchains and user manual come up empty. It does provide instruction tracing, application tracing and profiling though. There may be a way to combine it’s datastream and that of a current monitor.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.