In the last post, we setup our SEGGER J-Trace debug probe on the DK-S7G2 and setup a Blinky project using IAR Embedded Workbench (EW) for Synergy. We discussed a few potential warning messages that a developer might encounter when getting the ETM up and running. In today’s post, we will examine what information we can retrieve and how that can be useful to us when we want to debug our application or just verify that it behaves as expected.
From within IAR EW for Synergy during a debug session, there will be a menu item that appears named J-Link. Within this menu, there are several different options that may be interesting to a developer such as:
A quick truncated look at this menu can be seen below:
The first option that is interesting to investigate is the ETM Trace option. ETM Trace displays in a new window, every trace frame that is received from the ETM. In most cases, a frame contains an instruction that was executed by the CPU but there are also special frames such as synchronization frames that can be seen at the start of the following trace:
There are several useful reasons why a developer may want to perform instruction tracing such as:
The function trace option provides developers with a slightly higher up viewpoint than instruction tracing. It provides developers with a record for the order in which functions were executed. An example ETM Function Trace can be seen below:
The next useful trace feature is to perform function profiling. Function profiling uses the instruction trace to determine:
An example function trace can be found below:
As the reader can imagine, function tracing can be very useful to profile and discover where all the CPU clock cycles are being spent. If we expect an idle function to be called most of the time but discover instead that there is some other function utilizing 90% of the CPU, that could be pointing to a problem with application or a misunderstanding about how the system is supposed to operate. Either way, additional investigation and understanding would be necessary to make sure that the application is robust.
As one can image, attempting to search through a giant trace log can be time consuming. Developers can navigate through their code to functions and variables of interest, right click and then select “Find in Trace”. Their trace view will then filter for function that they were looking for in the trace.
There are also several other options which can be seen in the same menu below:
These options allow a developer to start and stop the trace at specific break-points in their code so that they can capture small data amounts that can be used to easily investigate and debug issues they are experiencing in their software.
In the next post, we will look at a third-party visualization tool, Percepio Tracealyzer that can be used to visual trace data. (The trace data doesn’t have to necessarily be received over ETM).
Until next time,
Live long and profit!
Hot Tip of the Week - Have you found the new Getting Started Guides that are being added to the Synergy Knowledge base? These guides provide a guided series of lessons that cover important development topics for the Synergy Platform.
One of the newly added Getting Started Guides covers basic debugging. It collects a wide variety of Synergy related documents, videos, Prof IoT posts, Renesas Academy courses and Knowledge Base articles and presents them in an easy to follow series that will get you up to speed with debugging in record time. Topics covered include:
Check it out here: https://en-us.knowledgebase.renesas.com/English_Content/Renesas_Synergy%E2%84%A2_Platform/Renesas_Synergy_Knowledge_Base/How_do_I_get_started_with_Debugging_in_SSP%3F