5
\$\begingroup\$

Is it possible to send arbitrary messages (as with printf()) via SWD for debugging?

\$\endgroup\$
  • \$\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 Stratton Feb 3 '15 at 17:27
2
\$\begingroup\$

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

\$\endgroup\$
  • \$\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\$ – andrey g Feb 3 '15 at 17:51
  • \$\begingroup\$ Looking at the wrong place. Use the key word "retargeting" or "retarget" \$\endgroup\$ – hassan789 Feb 3 '15 at 18:00
  • \$\begingroup\$ See edits above in answer \$\endgroup\$ – hassan789 Feb 3 '15 at 18:05
  • \$\begingroup\$ But that method is using UART1 and not SWD for data transmission? \$\endgroup\$ – andrey g Feb 3 '15 at 18:08
  • \$\begingroup\$ just realized that myself...see edit \$\endgroup\$ – hassan789 Feb 3 '15 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.