← Back to context

Comment by smackeyacky

2 days ago

Has anybody played with newlib, but grown the complexity as the system came together?

It seems like one thing to get a bare-bones printf() working to get you started on a bit of hardware, but as the complexity of the system grows you might want to move on from (say) pushing characters out of a serial interface onto pushing them onto a bitmapped display.

Does newlib allow you to put different hooks in there as the complexity of the system increases?

Newlib provides both a standard printf, which is necessarily big, and a printf that does not support any of the floating-point format specifiers.

The latter is small enough so that I have used it in the past with various small microcontrollers, from ancient types based on PowerPC or ARM7TDMI to more recent MCUs with Cortex-M0+.

You just need to make the right configuration choice.

You can always write a printf replacement that takes a minimal control block that provides put, get, control, and a context.

That way you can print to a serial port, an LCD Display, or a log.

Meaning seriously the standard printf is late 1970's hot garbage and no one should use it.