Notes on two debugging methods of keil using SWO in combination with st-link

Through strongerHuang's tutorial, two debugging methods of SWO are realized.
1. Use debug printf viewer to print information during keil debugging.
2. Burn the program and print the information in STM32 ST-LINK Utility.

A few pieces of information: excerpted from https://www.strongerhuang.com
SWD: Serial Wire Debug,
SWO: Serial Wire Output, Serial Wire Output
SWV: Serial Wire Viewer, Serial Wire Viewer
ITM: Instrumentation Trace Macrocell, instruction tracking macrocell

The SWO serial line output is a single-pin, asynchronous serial communication, which can be used on Cortex-M3/M4/M7 and is supported by the main debugger.

It uses the ITM module in the Cortex core to achieve this function.

Since there is no serial port on hand, information can only be output through st-link, and debugging methods are added. jlink can also output information through RTT and SWO methods.
There is a stlink in hand, so choose swo way.

For specific methods, please refer to the https://www.strongerhuang.com webpage or official account.
A few points to note:
1. If you want to print information in the Serial Wire Viewer of the STM32 ST-LINK Utility, it should be running in hex under stlink. The downloaded program in keil cannot be displayed in the Serial Wire Viewer.

2. If you directly debug and run at full speed in keil, you can directly debug, run, and open the debug printf viewer to see the printed information.

In addition, the keil project needs to open the function, add the redefinition of printf, and the clock frequency must be consistent. The default port number is 0.

This swo method is more efficient than serial port printing, and will not interfere with cpu operation. If you have jlink and stlink in the future, you can print without serial port. In terms of printing efficiency: UART <SWO <JLink-RTT. Remember that the nrf52 series uses JLink's RTT function by default.

The original text mentioned: Unlike UART-based text output, using ITM output will not cause a great delay to the application. There is a FIFO inside the ITM, which buffers the written output message.

3. SWO requires additional pins for stm, and the debug option in stmcubemx needs to be configured as TraceAsynchronous Sw mode.
4. RTT does not require additional pins and is more efficient. It can be seen that the strength of Segger is still very strong. Use the RTT function to write the record file again later.

https://www.cnblogs.com/CodeWorkerLiMing/p/12007396.html

Guess you like

Origin blog.csdn.net/tjcwt2011/article/details/112782642