Serial printing on STMF0Discovery

Hallo, can’t seem to get serial printing working on a STMF0 board. OpenOCD supports semihosting but it doesn’t work in PlatformIO. I want to use printf() in the same way as serial.println() works on Arduino. If someone can help me with this, that would be great.

What code do you have? How do you activate semihosting in the code and for GDB / openocd?