SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By othane
#183525
I am successfully using openocd's dcc feature to send my printf msg in my stm32 firmware to the openocd debugger using the code from libdcc .. this works well enough for my purposes to replace ITM_SendChar() from the CMSIS which I have used previously (I cannot see any easy to use support for ITM_SendChar in openocd, and I am using SWD interface on the st-link v2 so I am not sure if its even a option on this interface)

The problem is that the ITM_SendChar() routine used to check if both the ITM and ITM port 0 had been enabled before even trying to send the messages, this way it was possible to just leave this code in when debugging or not ... however the libdcc stuff has no check so if you make a printf call it will deadlock waiting to send the char's ... does openocd set a flag in one of the dcc cfg registers etc so you know it is connected (or at least has been connected) as I think it is too dangerous to use if by mistake to build a production bit of code without remembering to not define debug?

Alternatively if it is possible to get the ITM_SendChar() sending characters via SWD on the st-link v2 and have the output displayed in gdb that would be even better? .. I believe this is better as it is much faster and is buffered better by the core/debugger so there is very low overhead but correct me if I misunderstand please

Thanks