9.4.2 Streaming printf data over serial port without debug tool connected

The application implements the _write() function, which gets called whenever the IO buffer is full or a newline is detected in the printf string. The _write() function gets a block of bytes, which it sends to a serial port. The application needs to set up the serial connection.

A benefit of streaming printf data to serial port is that the and the application keeps running, servicing interrupts while the buffers are being flushed.

However, the device needs to have a serial port and dedicate it to the printf output. On the receiving side, the PC must run a terminal application that reads the serial port and displays the printf output. The link is typically bidirectional.