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

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

This article does not intend to cover all STM32CubeIDE provides information on how to use Serial Wire Viewer tracing (SWV) capabilities; complete information is available in (UM2609), chapter 4. It only provides some setup information for STM32MP15 serie, debugging Cortex-M in Production Mode.
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:
awk '/ck_trace/{print $5}' /sys/kernel/debug/clk/clk_summary
In order to test, let's modify main.c file from a generated project with a looping variable 'i', as depicted hereafter.

Trace clock from Linux console
Then, setup debug configuration, enabling SWV and setting the clock: 133.25MHz here.
Debug Configuration with SWV enabled
Stopping Debug session, open Serial Wire Views: Window > Show View > Other... > SWV > SWV Trace Log & SWV Data Trace.
In SWV Trace Log > Configure Trace menu, setup Comparator 0 in order to spy variable 'i'.
SWVConfigureTraceButton.png
SWV Setting
Then start the trace
SWVStartTraceButton.png

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

SWV Data Trace Output

with STM32MP15 serie on Cortex-M. It describes usage of printf() redirection using SWV/ITM on Cortex-M when running in Production Mode, Cortex-A Linux using the UART4 for its console.

Complete information on Serial Wire Viewer usage in STM32CubeIDE is available in chapter 4 of (UM2609).

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 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>

'''''awk '/ck_trace/{print $5}' /sys/kernel/debug/clk/clk_summary'''''<br>
<br>

In order to test, let's modify main.c file from a generated project with a looping variable 'i', as depicted hereafter.<br>

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

Then, setup debug configuration, enabling SWV and setting the clock: 133.25MHz here.<br>

[[File:Swv-dbg-cfg.png|frame|center|''Debug Configuration with SWV enabled]]<br>
<br>

Stopping Debug session, 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'. 
[[File:SWVConfigureTraceButton.png|none|frameless]]<br>

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

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

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

<br>

<br>



{{ClonedFrom | stm32mpu}}
This article provides information on how to use Serial Wire Viewer tracing (SWV) with STM32MP15 serie on Cortex-M. It describes usage of printf() redirection using SWV/ITM on Cortex-M when running in ''Production Mode'', Cortex-A Linux using the UART4 for its console.<br>


Complete information on Serial Wire Viewer usage in STM32CubeIDE is available in chapter 4 of ([[STM32MP15 resources#UM2609|UM2609]]). 
<noinclude>

[[Category:STM32CubeIDE|51]]</noinclude>
Line 1: Line 1:
{{ClonedFrom | stm32mpu}}
+
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 provides information on how to use Serial Wire Viewer tracing (SWV) with STM32MP15 serie on Cortex-M. It describes usage of printf() redirection using SWV/ITM on Cortex-M when running in ''Production Mode'', Cortex-A Linux using the UART4 for its console.
 
 
<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>
  +
'''''awk '/ck_trace/{print $5}' /sys/kernel/debug/clk/clk_summary'''''
  +
<br>
  +
<br>
  +
In order to test, let's modify main.c file from a generated project with a looping variable 'i', as depicted hereafter.
  +
<br>
  +
[[File:Swv-traceclk-linux-main.png|frame|center|''Trace clock from Linux console'']]
  +
<br>
  +
<br>
  +
Then, setup debug configuration, enabling SWV and setting the clock: 133.25MHz here.
  +
<br>
  +
[[File:Swv-dbg-cfg.png|frame|center|''Debug Configuration with SWV enabled]]
  +
<br>
  +
<br>
  +
Stopping Debug session, 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'.
  +
[[File:SWVConfigureTraceButton.png|none|frameless]]
  +
<br>
  +
[[File:Swv-settings.png|frame|center|''SWV Setting'']]
  +
  +
Then start the trace [[File:SWVStartTraceButton.png|none|frameless]]
  +
Resuming debug session gives inside ''SWV Data Trace'' view the corresponding graphic. 
  +
<br>
  +
[[File:Swv-data-trace.png|frame|center|''SWV Data Trace Output'']]
  +
  +
<br>
  +
  +
<br>
  +
  +
<br>
  +
  +
  +
   
Complete information on Serial Wire Viewer usage in STM32CubeIDE is available in chapter 4 of ([[STM32MP15 resources#UM2609|UM2609]]).