A major limitation with our previous Tracealyzer tools has been the limited trace length and/or large RAM requirements. The recorder could only store as much trace as its RAM buffer allowed. This could at most give a few seconds of trace on most microcontrollers. Can be very valuable, but also rather restricted in many cases.

In Tracealyzer v3.0, initially for FreeRTOS and SEGGER embOS, we have a new solution that allows for continuous trace streaming with very small RAM usage. It works really well and is very simple to use. In my view, this is really cool!

This is software-defined RTOS trace, like our earlier solution, but leverages hardware-acceleration through the SEGGER J-Link debug probes. The trace data is stored in a small RAM buffer, from which the J-Link pulls the data in the background over SWD or JTAG, without interfering with the embedded application.

The core of this solution is a quite new function in the SEGGER J-Link debug probes, Real-Time Transfer, or RTT for short. This uses the debugger’s standard memory access function to provide buffered transfer at speeds up 700 KByte/s on a standard J-Link. RTT uses a small RAM buffer which is periodically checked by the J-Link debugger for new data, without disturbing the target system. Since this communication is very fast, the RTT buffer typically only needs to be 1 KB, or even less.

When used by Tracealyzer, the result is essentially unlimited RTOS-level trace, on standard hardware, with much lower CPU and RAM overhead than our earlier solution. Very easy to set up and perfectly reliable. You can now trace for many hours, instead of a few seconds. The data rate from the embOS-Trace recorder library is typically in the range 20-200 KB/s, so a 1 hour trace file is usually less than 1 GB, a quite manageable file.


But what really impressed me: this works even on a low-cost SEGGER J-Link OB, designed for integration on development boards. I did an experiment using an Atmel evaluation board (the SAM4S-Xplained) containing such a debug probe. It is just a ARM Cortex-M3 microcontroller running SEGGER’s debugger firmware, connecting the USB debug port with the target processor debug port.

The firmware-based debugger only do basic things like reading and writing to specific addresses, so SEGGER has implemented the RTT protocol in the host-side drivers. This means that RTT polling is driven from the host computer and each request is sent over USB, serviced by the debugger MCU and then returned over USB. My expectations regarding the performance was therefore quite modest…

But I was actually able to pull about 110 KByte/s from target to host via RTT, which is really not bad, especially since the target system only needed to dump the data in a RAM buffer, and the transfer was handled in the background!

I’m quite confident that the increasing debugger performance, even in low-cost debug probes, will allow for increasingly advanced tools for runtime analysis. Tools like Tracealyzer will be able to extract much more data from run-time systems, with minimal impact, for increasingly powerful analysis and visualization support.