SWO ITM printf() output using ST-LINK utility while debugging
I have been able to get printf() to output via SWO by following the information in this post:
http://www.openstm32.org/forumthread2893
I did not change the linker flags, nor did I add the “arm semihosting enable” options to the start script.
Additionally, I made no changes to the syscalls.c file. Instead, I created my own _ _io_putchar() routine in my main.c file as follows:
- include // printf()
int __io_putchar(int ch) {
ITM_SendChar( ch );
return ( ch );
}
If I download the code and run it, I can use the ST-LINK utility “Print via SWO viewer” option and see my printf() calls executing. So all this is great so far.
What I can’t do, however, is see the output while I am single-stepping through the code. If the debugger is running (via the ST-LINK_V2 interface), the ST-LINK utility can’t find the ST-LINK_V2 adapter. If I start the ST-LINK utility before I start to debug the code, the debugger won’t start, eventually giving me the error message:
“Error in final launch sequence
Failed to execute MI command:
-target-select remote localhost:3333
Error message from debugger back end:
localhost:3333: The system tried to join a drive to a directory on a joined drive.
localhost:3333: The system tried to join a drive to a directory on a joined drive.”
What am I doing wrong? I assumed it would be possible to use the ITM printf() method while debugging.
Your assistance is greatly appreciated.
Thanks,
Dale