How to debug with Serial Wire Viewer tracing on STM32MP15

Stable: 02.12.2021 - 21:54 / Revision: 25.11.2021 - 17:32

I am here to prevent the first-page-empty bug!

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




IMPORTANT NOTICE – READ CAREFULLY
STMicroelectronics NV and its subsidiaries ("ST") reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order acknowledgment.

Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of purchasers’ products.

No license, express or implied, to any intellectual property right is granted by ST herein.

Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.

ST and the ST logo are trademarks of ST. For additional information about ST trademarks, refer to www.st.com/trademarks. All other product or service names are the property of their respective owners.

Information in this document supersedes and replaces information previously supplied in any prior versions of this document.