In this series so far, we’ve been examining fundamental debugging techniques such as breakpoints, printf and assertions. The debugging capabilities available to developers in a modern microcontroller typically go far beyond these fundamental capabilities. The very toolchain that is being used and the microcontroller itself can determine the capabilities that are available to a developer. In this post, we are going to examine what hardware features a developer should be looking for in their microcontroller that will assist them in debugging their applications.
The hardware capabilities that are available in a microcontroller can vary widely but for the Renesas Synergy™ microcontrollers, the debugging capabilities are really broken up into two categories, the S1 family and then S3, S5 and S7 families. The S1 family is designed to be a low power, energy efficient part which means that all the bells and whistles for debugging aren’t included on the part.
The S1 family has a Serial Wire Debugging (SWD) interface which is fast and efficient. The S1 also includes a Breakpoint Unit (BPU) which has four hardware breakpoints and a Data Watchpoint (DWP) unit that allows up to two data watch points. Quite a few Arm based microcontrollers only include two hardware breakpoints which can be super annoying to debug so including two extras can really make debugging a Synergy MCU much easier. The included Micro Trace Buffer (MTB) allows this energy efficient device to still perform application tracing so that a developer can efficiently debug their application. (We will be discussing this in several blogs later in the series).
Once a developer moves into the S3, S5 or S7 families, the physical hardware modules that are used to debug an application are different but perform some of the same functionality. For example, BPU is replaced with a Flash Patch Breakpoint Unit (FPU) which includes six instruction comparators and two literal comparators. The DWP is swapped out for a Data Watchpoing and Trace module that allows up to four data watchpoints.
The S3, S5 and S7 families also include far more enhanced capabilities for debugging. For example, the ability to perform application tracing is dramatically enhanced through the Embedded Trace Macrocell (ETM). The ETM allows a developer to get real-time tracing and data from the processor and can be used to debug applications and also verify them. In order to get real-time trace and view the application behavior, the processor requires a Time Stamp Generator (TSG) that automatically generates a timestamp for all trace information. This helps to minimize any overhead necessary to perform the tracing. Using an Embedded Trace Buffer (ETB) keeps track of events which can then be downloaded when the processor is idle and works behind the scene seamlessly so that a developer doesn’t even know that it is there.
The Instruction Trace Macrocell (ITM) is another hardware module that developers should be very interested in. The ITM allows a developer to send printf style messages through hardware in a much faster and more efficient manner than using a UART or semi-hosting.
A basic comparison between the different Synergy microcontrollers and what debugging hardware they have available can be seen below:
MCU
MTB
DWP
BPU
DAP
ETM
ITM
DWT
FPB
TSG
ETB
S124
X
2
4
SWD
S128
S3A3
JTAG / SWD
6/2
1k
S3A6
S3A7
S5D5
2k
S5D9
S7G3
I can never remember the Arm abbreviations so if you are like me, you can find a quick reference below:
Arm Abbreviation Definitions
MTB – Micro Trace Buffer
DWP – Data Watchpoint
BPU – Breakpoint Unit
DAP – Debug Access Port
ETM – Embedded Trace Macrocell
ITM – Instruction Trace Macrocell
DWT – Data Watchpoint and Trace
FPB – FLASH Patch Breakpoint Unit
TSG – Time Stamp Generator
ETB – Embedded Trace Buffer
In the next post, we will start examining how these hardware features can be used to gain useful insights into not just how applications are behaving but also to spot potential bugs in our application code.
Until next time,
Live long and profit!
Professor_IoT
Hot Tip of the Week
To learn more about the hardware elements behind MCU debugging features take a look at the Hardware User Manuals (HUMs) for your target MCU. All the Synergy HUMs can be found on Renesas.com. From any Synergy web page, just select Microcontrollers from the left side guide bar, then the documentation tab and then filter on User’s Manual: Hardware, as seen below.
The User’s Manuals for you target MCU will show up in the list below the filter selection box. You can find the hardware debug capabilities listed in the CPU section of the manual.
Also, don’t overlook the Technical Updates listed below any MCU document download window. These Updates explain important corrections or precautions you need to be aware of when developing with the selected Synergy MCU. Below is an example of a partial list for the S1 MCU Series.