We have an embedded ARM project using newlib (as provided by VisualGDB). We’d like to override printf’s behavior by redirecting to a COM port (semihosting causes us to miss many realtime deadlines).
Yes, you can simply provide your own implementations for the _isatty() and _write() functions and the newlib will call them. We recommend looking into FastSemihosting.cpp and copying the code surrounded by “#if FAST_SEMIHOSTING_STDIO_DRIVER” into your own source file. Note that you need to declare those functions as extern “C” as otherwise the newlib won’t recognize them properly.