Is it possible to send debugging messages from MCU to PC over SWD via GDB without interrupting the running code (ie. without using breakpoints), like we could do via UART of MCU by sacrificing 2 UART pins?
\$\begingroup\$
\$\endgroup\$
6
-
1\$\begingroup\$ You mean Semihosting? \$\endgroup\$– Jeroen3Jun 20, 2019 at 9:05
-
\$\begingroup\$ Similar to semihosting: OpenOCD DCC, or SEGGER RTT. Both define a debug channel over JTAG/SWD that works in addition to gdb. \$\endgroup\$– Turbo JJun 20, 2019 at 9:18
-
\$\begingroup\$ @Jeroen3 It seems so, yes. I've searched my toolchains with the keyword "Semihosting" and I found this from stlink, this from ChibiOS. \$\endgroup\$– ceremcemJun 20, 2019 at 9:22
-
\$\begingroup\$ @Jeroen3 You may duplicate your comment as an answer so I could accept it. \$\endgroup\$– ceremcemJun 20, 2019 at 10:56
-
\$\begingroup\$ I have to say that this seems to me like asking how to make a Tesla into a tricycle. Debugging with SWD is so much more powerful than using print statements. With a decent IDE you should be able to trace whatever activity you want. \$\endgroup\$– Elliot AldersonJun 20, 2019 at 14:20
|
Show 1 more comment
1 Answer
\$\begingroup\$
\$\endgroup\$
This can be achieved by something is called semihosting. How this is implemented depends on the specific devices and software you are using.
It works by using an SVC and BKPT instructions to trigger an action from the debugger host.