setup_swo
Configure STM32 TPIU/ITM for SWO printf from the debugger using the core clock and SWO baud, without firmware ITM setup. Returns OpenOCD capture commands and a printf retarget snippet.
Instructions
One-call SWO/ITM printf setup. Configures the target's TPIU+ITM from the debugger (no firmware ITM-init needed) for the given core clock (hclk_hz) and SWO baud, and returns the OpenOCD capture commands + the firmware printf retarget snippet. Then capture with logging(action=start, channel='swo', file=). Requires the SWO pin (e.g. PB3) wired to the probe.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | ITM stimulus port for printf (default 0). | |
| output | No | OpenOCD ITM decode output file to tail (default 'swo_itm.log'). | |
| swo_hz | No | Desired SWO baud (default 2000000; ST-Link V2 max ~2 MHz). | |
| hclk_hz | Yes | Core clock (HCLK) in Hz, e.g. 80000000 for an L4 at 80 MHz. | |
| session | No | Optional debug-session name. Omit for the default target. | |
| tpiu_name | No | OpenOCD tpiu object name if not the default '$_CHIPNAME.tpiu'. | |
| apply_openocd | No | Also run the OpenOCD capture commands via monitor now (default false). |