Is it possible to send arbitrary messages (as with printf()) via SWD for debugging?
-
\$\begingroup\$ Yes, but you need software on the device to stage messages or bytes (rather than writing them to the traditional UART), and software on the debug host to claim them. Various open and proprietary implementations exist. \$\endgroup\$– Chris StrattonFeb 3, 2015 at 17:27
1 Answer
Yes, its called "Retargeting printf via ITM". its very easy to do with STM32.
EDIT:
You just need write a small "retarget.c" file. The key to this is using the "ITM_SendChar()" function. Great tutorial here: http://www.doulos.com/knowhow/arm/Retargetting_a_C_library_function/
I've personally have done this in the past and it works amazing in keil. Keil also has a bunch of tutorials on this. If you still have trouble, let me know
-
\$\begingroup\$ Googling "STM32 SemiHosting" gave me a bunch of solutions involing custom assembly programs and modifying the linker. Is this what you mean by "very easy" or am I looking at a wrong place? \$\endgroup\$– andreyFeb 3, 2015 at 17:51
-
\$\begingroup\$ Looking at the wrong place. Use the key word "retargeting" or "retarget" \$\endgroup\$ Feb 3, 2015 at 18:00
-
-
\$\begingroup\$ But that method is using UART1 and not SWD for data transmission? \$\endgroup\$– andreyFeb 3, 2015 at 18:08
-