modm API documentation
|
lbuild module: modm:printf
This is a small but fully-loaded implementation of C's formatted printing family of functions. It was originally designed by Marco Paland, with the primary use case being in embedded systems - where these functions are unavailable, or when one needs to avoid the memory footprint of linking against a full-fledged libc. The library can be made even smaller by partially excluding some of the supported format specifiers during compilation. The library stands alone, with no external dependencies**.
For the library API see https://github.com/eyalroz/printf#library-api.
On embedded targets, the printf
family of functions are automatically replaced by this module using the -fno-builtin-printf
compile flag to prevent compiler optimizations to substitute simple calls with puts
. 64-bit integer support is disabled by default on AVRs. You can overwrite these defaults in a modm_config_printf.h
file placed into your top-level include path:
All output is directed to a single function, which you must overwrite in your application to the interface of your choice.
This module is not included by default and any attempt to use any of the printf methods fails with one or multiple linker error messages similiar to this:
This is to prevent you from accidentally using the Newlib implementation of printf, which is very expensive and also dynamically allocated memory. You can either: