Is printf debugging over USB with STM32 possible?
printf debugging over USB for the STM32


There is CDC example code that one could use for printf().

But I would not recommend using this, because USB is rather brittle in case of programming errors: The USB interrupt must be working correctly, the host won't accept the device otherwise.

Printf over UART/USART is far simpler, and you may need this connection for the bootloader anyway.  Unless you have a JTAG/SWD debugger - but then there is no need for printf debugging in the first place.