Electronic – Printf style debugging via SWD

armcortex-m0stm32

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

Best 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