printf by default refers to USB TX and RX ?

07 Nov 2014


is printf by default use usb tx & rx as the pinout?

Where can I find this declaration ?

I notice that printf works, even if we don't declare Serial pc(USBTX, USBRX); And wed don't even have to use pc.printf, instead we can just call printf

Thank you

17 Nov 2014

I set breakpoint in Serial putc to see why. It is because retarget.cpp implements posix stdio. It happens because mbed::Stream uses FileLike, and mbed::Serial uses mbed::Stream. When printf occurs, the _write function in retarget.cpp puts to serial port in fhc->write(buffer, length).

18 Nov 2014

Wayne described it well. THere's retarget code file which does all required for printf work "out of the box".