Printf debugging AN4989
76/118 AN4989 Rev 3
library which split trace between stimulus based on their importance (info, debug,
error) or there source.
STM32CubeIDE
With STM32CubeIDE you also have to redirect printf to SWO by some piece of code.
With syscall.c integrated to the project:
#include "stdio.h"
int __io_putchar(int ch)
{
ITM_SendChar(ch);
return(ch);
}
Without syscall, add:
int _write(int file, char *ptr, int len)
{
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++)
{
__io_putchar(*ptr++);
}
return len;
}
Enable SWD in Debug configuration ? Debugger pane (see Figure 55).
Core clock must be the same as Cortex clock. You can then start the debug session.