Overload printf, etc. with newlib

Sysprogs forums Forums VisualGDB Overload printf, etc. with newlib

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8513
    cybspi
    Participant

    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).

    Any suggestions?

    #8515
    support
    Keymaster

    Hi,

    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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.