STM32F401 advanced debugging UM1671
16/19 DocID025194 Rev 1
3 STM32F401 advanced debugging
The STM32 family using the Cortex-M4 processor includes many interrupts, and it can be
difficult to determine when they are being activated and how often.
The Serial Wire Viewer (SWV) tool of on the STM32F401 family makes this task easy. SWV
displays PC samples, exceptions (including interrupts), data reads and writes, ITM (printf),
CPU counters and a timestamp. This information comes from the ARM CoreSight™ debug
module integrated into the STM32F401 CPU.
SWV does not steal any CPU cycles and is non-intrusive (except for the ITM Debug printf
Viewer).
You have already configured SWV on the template project. This allows:
1. Retargeting printf to the ITM stimulus port(0). This facilitates the display of the debug
messages.
How to use it:
– EWARM: View > Terminal IO
– MDK-ARM: View > Serial Windows Debug (printf) Viewer
– TrueSTUDIO: View > SWV Console
2. Exception trace:
Provides information on the exception:
– Entry: when the exception enters.
– Exit: when the exception exits or returns.
– Return: when all the exceptions have returned to the main XXX
How to use it:
– EWARM: ST-LINK > Interrupt log
– MDK-ARM: View > Trace > Exceptions
– TrueSTUDIO: View > SWV Exception Trace Log
3. Function profiler: shows timing information for the functions in an application
– EWARM: ST-LINK > Function Profiler
– MDK-ARM: View > Analysis Window > Code Coverage
– TrueSTUDIO: View > SWV Statistical Profiling
4. Data Trace Timeline: shows a graphical representation of the data
– EWARM: ST-LINK > Timeline (Data log)
– MDK-ARM: View > Analysis Window > Logic Analyzer
– TrueSTUDIO: View > SWV Data Trace Timeline