Help me configure and use printf with STM32 Bluepill

I would like to use the printf() functionality debugging my STM32 Bluepill board with a Blackmagic probe.
I heard about an ITM functionality which is provided by the CORTEX M3/M4/M7 MCUs as well as semihosting, but I have no idea how to set up my project to use it.

My Environment:

1-VSCode + PlatformIO
2-Blackmagic Probe for uploading and debugging firmware
3-STM32 Bluepill Dev. Board.

Just guide me through the process of setting up my project to use the printf() functionality.

Thank you.

Using this repository I solved it.