How to use ITM Printf inside a Console of STM32CubeIDE
Hello,
I would like to use the ITM Printf directly inside a Console of STM32CubeIDE but It doesn't work on my side.
I was able to display a character inside a "SWC ITM data Console" by using ITM_SendChar(). But I have the next issues:
- For using printf, I read somewhere that I have to change the _write function inside syscalls.c like this:
__attribute__((weak)) int _write(int file, char *ptr, int len)
{
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++)
{
ITM_SendChar( *ptr++ );
}
return len;
}But even with this change, printf doesn't work.
- It seems that it is mandatory to click on "Start Trace" on "SWV ITM Data Trace" each time I want to use the console display. So I have to do it every time I run a new debug session. There is a easy way to enable by default the "Start Trace " at each debug session?
Thansk for your help.