I had created aan RTOS project using CubeMX and added a printf and had the same issue on linking, while debugging using openocdOpenOCD.
I replaced the printf("Hello ARM World!") with trace_puts("Hello ARM World!"); and had the messages appear onin the debug console.