Debugging Synergy Applications: Debugging using the Embedded Trace Macrocell

There comes a time during the debugging process when a developer needs to pull out the “big guns” to debug and verify their embedded application. This can occur when a complex problem is encountered or when a developer wants to perform an in-depth analysis to understand how their software is functioning. When these situations arise, it may be time to consider using the Embedded Trace Macrocell (ETM).

The ETM is a hardware tool that is built into the Cortex-M4 that is at the heart of every Renesas Synergy microcontroller. The ETM hardware allows a developer to monitor the instruction execution stream that is happening on the microcontroller core. This means that every instruction that is executed by the CPU is recorded by the ETM hardware and then provided back to the debugger so that an instruction history can be generated and reviewed by the developer.

The ETM opens up the possibility for developers to debug and verify their systems at a level that wouldn’t be possible otherwise. Since every instruction executed is monitored, developers can perform several new analyses on their systems. These include:

  • Instruction tracing
  • Code coverage
  • Instruction coverage
  • Execution tracing

In order to use the ETM, there are several key requirements that must be met by the system and the debugging probe. First, the Renesas Synergy™ microcontroller must be a S3, S5 or S7. These microcontrollers are Cortex-M4 parts which include the ETM hardware module in the silicon. The S1 is a Cortex-M0+ which is a low-power part and does not include an ETM. Instead, it has a Macro Trace Buffer which is more energy efficient but also won’t provide instruction tracing. 

Second, if a developer is using a development board, the board must include a JTAG+ETM connector. This is typically a 20-pin JTAG connector that includes SWD, JTAG and the ETM signals. Developers working with a board such as the DK-S7G2, will be able to connect their ETM compatible debug probe to the board and receive instruction trace information. WARNING! The reader must check their development board user manual to see if the ETM channels are available. The SK-S7G2 which has the same microcontroller as the DK-S7G2 does NOT provide the ETM pins on the 14-pin, external JTAG connector.

Third, a developer needs a debugging probe that supports ETM. There are several different ones on the market such as Segger J-Trace, IAR I-Jet Trace and Keil U-Link pro just to name a few. These tools are third party commercial tools that are not on-board the development kits and need to be purchased separately. Typically, you can expect to pay between $1000 and $2000 USD for a debugger that has ETM trace capability. At first glance the price may seem steep but once a developer starts using the capabilities, they pay for themselves in no time.

Finally, depending on the debugging probe that is being used, a developer needs software that goes with their debug probe that can record the trace data, analyze the stream and provide insights into how the system is performing. A developer using the Segger J-Trace would use Ozone while a developer using IAR I-Jet Trace would be IAR Embedded Workbench. The software rebuilds the instruction stream and allows the code coverage and statistical analysis to be performed on the embedded system.

In the next post, we will show how a developer can perform statistical profiling, instruction tracing and verification using a Segger J-Trace and Ozone.

Until next time,

Live long and profit!


Hot Tip of the Week Have You Registered for DevCon Online? If you haven’t registered for DevCon online you are missing out on some important webinars. Register at the link and you will be able to access, free of charge, on-demand webinars on important topics. Stay tuned for additional Synergy related content. Enjoy!