Difference between revisions of "How to debug with Serial Wire Viewer tracing on STM32MP15"

[quality revision] [checked revision]
(Merge articles)
m
 

This article does not intend to cover all STM32CubeIDE Serial Wire Viewer (SWV) capabilities; complete information is available in (UM2609), chapter 4. It only provides some setup information for STM32MP15 serie, debugging the Cortex®-M of STM32MP15xx microprocessors in Production Mode. Complete information is available in the chapter 4 of STM32CubeIDE user guide (UM2609).

In that this mode, the available console on the board (UART4) is used by the Cortex®-A Linux®. The clock tree is managed by Linux® and 'Trace clock' needed to setup SWO is available from Linux® console with command:
awk '/ck_trace/{print $5}' /sys/kernel/debug/clk/clk_summary
In order to
To make a test, let's modify file main.c file from a generated project with a looping variable 'i', as depicted hereafterbelow.

Trace clock from the Linux® console



Then, setup the debug configuration, enabling SWV and setting the clock: 133.25MHz here25 MHz in the example below.

Debug Configuration configuration with SWV enabled



Stopping Debug session, Stop the debug session and open Serial Wire Views: Window > Show View > Other... > SWV > SWV Trace Log & SWV Data Trace.
In the SWV Trace Log > Configure Trace menu, setup set up Comparator 0 in order to spy variable 'i'.

SWVConfigureTraceButton.png


SWV Settingsetting
Then start the trace.
SWVStartTraceButton.png

Resuming the debug session gives the corresponding graphic shown below inside the SWV Data Trace view the corresponding graphic.

SWV Data Trace Outputdata trace output


This article does not intend to cover all STM32CubeIDE Serial Wire Viewer (SWV) capabilities; complete information is available in  ([[STM32MP15 resources#UM2609|UM2609]]), chapter 4. It only provides some setup information for STM32MP15 serie, debugging Cortex-M in ''Production Mode''. <br>
<br>

In thatdebugging the Cortex<sup>®</sup>-M of STM32MP15xx microprocessors in ''Production Mode''. Complete information is available in  the chapter 4 of STM32CubeIDE user guide ([[STM32MP15 resources#UM2609|UM2609]]).<br>
<br>

In this mode, the available console on the board (UART4) is used by the Cortex<sup>®</sup>-A Linux<sup>®</sup>. The clock tree is managed by Linux<sup>®</sup> and 'Trace clock' needed to setup SWO is available from Linux<sup>®</sup> console with command:  <br>

'''''awk '/ck_trace/{print $5}' /sys/kernel/debug/clk/clk_summary'''''<br>
<br>
In order toTo make a test, let's modify file main.c file from a generated project with a looping variable 'i', as depicted hereafterbelow.<br>

[[File:Swv-traceclk-linux-main.png|frame|center|''Trace clock from the Linux<sup>®</sup> console'']]<br>
<br>

Then, setup the debug configuration, enabling SWV and setting the clock: 133.25MHz here25 MHz in the example below.<br>

[[File:Swv-dbg-cfg.png|frame|center|''Debug Configurationconfiguration with SWV enabled]]<br>
<br>
Stopping Debug session, Stop the debug session and open Serial Wire Views:  ''Window'' > ''Show View'' > ''Other...'' > ''SWV'' > ''SWV Trace Log & SWV Data Trace''. <br>

In the ''SWV Trace Log'' > ''Configure Trace'' menu, setup set up ''Comparator 0'' in order to spy variable 'i'. 
[[File:SWVConfigureTraceButton.png|none|frameless]]<br>

[[File:Swv-settings.png|frame|center|''SWV Settingsetting'']]

Then start the trace. [[File:SWVStartTraceButton.png|none|frameless]]
Resuming the debug session gives inside the corresponding graphic shown below inside the ''SWV Data Trace'' view the corresponding graphic.  <br>

[[File:Swv-data-trace.png|frame|center|''SWV Data Trace Output'']]
<br>

<br>

<br>



data trace output'']]
<noinclude>

[[Category:STM32CubeIDE|51]]{{PublicationRequestId | 19686 (LudovicB) |2021-04-20 }}</noinclude>
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This article does not intend to cover all STM32CubeIDE Serial Wire Viewer (SWV) capabilities; complete information is available in  ([[STM32MP15 resources#UM2609|UM2609]]), chapter 4. It only provides some setup information for STM32MP15 serie, debugging Cortex-M in ''Production Mode''.  
+
This article does not intend to cover all STM32CubeIDE Serial Wire Viewer (SWV) capabilities. It only provides some setup information for debugging the Cortex<sup>®</sup>-M of STM32MP15xx microprocessors in ''Production Mode''. Complete information is available in  the chapter 4 of STM32CubeIDE user guide ([[STM32MP15 resources#UM2609|UM2609]]).
 
<br>
 
<br>
 
<br>
 
<br>
In that mode, the available console on the board (UART4) is used by Cortex-A Linux. The clock tree is managed by Linux and 'Trace clock' needed to setup SWO is available from Linux console with command:  <br>
+
In this mode, the available console on the board (UART4) is used by the Cortex<sup>®</sup>-A Linux<sup>®</sup>. The clock tree is managed by Linux<sup>®</sup> and 'Trace clock' needed to setup SWO is available from Linux<sup>®</sup> console with command:  <br>
 
'''''awk '/ck_trace/{print $5}' /sys/kernel/debug/clk/clk_summary'''''
 
'''''awk '/ck_trace/{print $5}' /sys/kernel/debug/clk/clk_summary'''''
 
<br>
 
<br>
 
<br>
 
<br>
In order to test, let's modify main.c file from a generated project with a looping variable 'i', as depicted hereafter.
+
To make a test, modify file main.c from a generated project with a looping variable 'i', as depicted below.
 
<br>
 
<br>
[[File:Swv-traceclk-linux-main.png|frame|center|''Trace clock from Linux console'']]
+
[[File:Swv-traceclk-linux-main.png|frame|center|''Trace clock from the Linux<sup>®</sup> console'']]
 
<br>
 
<br>
 
<br>
 
<br>
Then, setup debug configuration, enabling SWV and setting the clock: 133.25MHz here.
+
Then, setup the debug configuration, enabling SWV and setting the clock: 133.25 MHz in the example below.
 
<br>
 
<br>
[[File:Swv-dbg-cfg.png|frame|center|''Debug Configuration with SWV enabled]]
+
[[File:Swv-dbg-cfg.png|frame|center|''Debug configuration with SWV enabled]]
 
<br>
 
<br>
 
<br>
 
<br>
Stopping Debug session, open Serial Wire Views:  ''Window > Show View > Other... > SWV > SWV Trace Log & SWV Data Trace''. <br>
+
Stop the debug session and open Serial Wire Views:  ''Window'' > ''Show View'' > ''Other...'' > ''SWV'' > ''SWV Trace Log & SWV Data Trace''. <br>
In ''SWV Trace Log > Configure Trace'' menu, setup ''Comparator 0'' in order to spy variable 'i'.  
+
In the ''SWV Trace Log'' > ''Configure Trace'' menu, set up ''Comparator 0'' in order to spy variable 'i'.  
 
[[File:SWVConfigureTraceButton.png|none|frameless]]
 
[[File:SWVConfigureTraceButton.png|none|frameless]]
 
<br>
 
<br>
[[File:Swv-settings.png|frame|center|''SWV Setting'']]
+
[[File:Swv-settings.png|frame|center|''SWV setting'']]
   
Then start the trace [[File:SWVStartTraceButton.png|none|frameless]]
+
Then start the trace. [[File:SWVStartTraceButton.png|none|frameless]]
Resuming debug session gives inside ''SWV Data Trace'' view the corresponding graphic.   
+
Resuming the debug session gives the corresponding graphic shown below inside the ''SWV Data Trace'' view.   
 
<br>
 
<br>
[[File:Swv-data-trace.png|frame|center|''SWV Data Trace Output'']]
+
[[File:Swv-data-trace.png|frame|center|''SWV data trace output'']]
 
 
<br>
 
 
 
<br>
 
 
 
<br>
 
 
 
 
 
 
 
 
 
   
   
 
<noinclude>
 
<noinclude>
 
[[Category:STM32CubeIDE|51]]
 
[[Category:STM32CubeIDE|51]]
  +
{{PublicationRequestId | 19686 (LudovicB) |2021-04-20 }}
 
</noinclude>
 
</noinclude>