This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to configure debug printf viewer correctly?

Hello,
I would like to use printf in my custom board and see the result in the debug (printf) viewer window. µController is a STM32F7
As a starting point I looked at a working example for the STM32F746 discovery board, example is "File system demo" for the discovery board. Printf is used in this example and I see the output in the debug window.

Next:
I want to modify an existing example to get the printf working. I open the example "CMSIS RTOS Blinky" for this board and do the following modification:
- add a code line printf("hello blinky"); after the call of osKernelStart()
- in "Manage Runtime Component" in "Compiler::I/O I activate the checkbox for STDERR, STDIN, STDOUT and set Variant to "ITM"
-I add the initialization file "stm32_swo.ini" in the tab "Debug"
-I modify the linker script like in the working file system demo: add a section
RW_RETARGET 0x2000FFF0 0x00000010 { retarget_io.o (+ZI +RW) }
(altought I'm not sure whether this is really required).
-In the Trace configuration I activate "Trace Enable" and ITM Stimulus Ports, Enable to 1

But after compile/flash/debugging I don't see the debug output text.
Obviously something is missing, but I can't find any other differences between the working and not working example.
Does anyone have an idea what is missing?

The debug output is working if I add the function

int fputc(int c, FILE *stream)
{
   return ITM_SendChar(c);
}

Regards, Gunnar