In the last post, we started to examine the Embedded Trace Macrocell (ETM) that is included on the Renesas Synergy™ Cortex-M microcontrollers. In today’s post, I will show you how to setup and use the ETM to trace the Blinky with ThreadX application on a DK-S7G2 development board. I will be using the IAR Embedded Workbench (IAR EW) for Synergy to receive the trace information.
For this example, I am going to utilize the Blinky project that I created in e2 Studio and then imported into IAR EW. This is done following the Importing a Renesas Synergy Project into IAR EW application note. The reader may also find the DK-S7G2 user manual to be helpful as well.
The first step, is to purchase or get access to an ETM compatible debugging probe. The J-Link On-Board (OB) debugger which is built into the DK-S7G2 development board does not support trace capability. There are several debug probes on the market that support ETM Trace for Arm Cortex-M parts. For example, there is the IAR I-Jet Trace and there is also the SEGGER J-Trace. For this blog, we are going to use the SEGGER J-Trace.
Next, a developer needs to locate the JTAG connector on the DK-S7G2 and connect their trace probe. The JTAG connector is J16 and is located directly below the J-Link OB as shown in the image below:
At this point, the hardware connection are setup and we are ready to configure our Synergy project.
The next step is to open the Blinky project in IAR EW for Synergy and open the Synergy Configurator. By default, the trace pins are not enabled in the pin settings. If we attempted to start a debug session, we would get an error stating that the trace clock could not be detected. Under the pins tab, under peripherals locate Trace. Enable TRACE0 as shown in the image below:
The project can now be generated, built and a debug session started. If everything goes well, the developer should enter into the debugging session without any warnings or issues. However, there are two potential warnings that a developer may encounter that might require a response.
The first warning is related to an issue with IAR EW for Synergy version 7.71.3 and how it works with a SEGGER J-Trace. A developer using this toolchain version may find that after starting the debug session they receive the following error:
This error has nothing to do with our setup! It turns out that there is an issue with the J-Trace and IAR EW 7.71.3 (which has been resolved in IAR EW version 8.21.1 and later). If you are using IAR EW 7.71.3, you need to download R7FS7G2x.dmac (see the tip at the end of this post) and copy it into the following folder:
The developer should now restart IAR EW and when starting a debug session, they will no longer get the error message but instead be able to retrieve trace data!
The second message that a developer may see, is the following:
Simply selecting no and continuing the debug session does not appear to have any ill side effects. The session begins as expected and trace data is received successfully.
In the next post, we will look at the information that we can receive from the ETM and what it can tell us about how our application is behaving.
Until next time,
Live long and profit!
Hot Tip of the Week: You can find the file referenced in this article on the Synergy Knowledge Base. You can simply search in the Knowledge Base for Prof IoT. Just type in “Prof IoT” into the search bar here: https://en-us.knowledgebase.renesas.com/English_Content/Renesas_Synergy%E2%84%A2_Platform/Renesas_Synergy_Knowledge_Base
The related article will show up. Remember to use the search bar when trying to find information on a topic when you don’t already have the location.
Here is the actual link if you are in a hurry. https://en-us.knowledgebase.renesas.com/English_Content/Renesas_Synergy%E2%84%A2_Platform/Renesas_Synergy_Knowledge_Base/Where_can_I_find_the_replacement_file_referenced_in_the_Prof_IoT_article_on_ETM_Trace_%3F