How do I redirect STDIO to the DIAG header?

RCM4000. I’d like to be able to see the STDIO output when the device is not in debug mode using the DIAG header.

The macro STDIO_DEBUG_SERIAL may be defined to redirect Stdio output to a designated serial
port, this can be A, B, C or D. For more information, please see the sample program