The purpose of this project is to provide a very very tiny (but still useful) implementation of printf for embedded systems.
Not long ago, I was doing an embedded project on an 8051 variant. I found the library printf bundled with the compiler was broken and useless. That inspired the idea of a versatile and bug free version of printf, that would compile on everything from an 8 bit microcontroller (in less than 2k - 4k) to modern Linux and still be useful.
This project was coded with the following constraints:
Characters should be printed in the order that they are sent to the serial port (and provide a hook for that).
Parse table for printf "language" should be very small but still handle all cases gracefully.
Small functions using mostly eight bit data types with few parameters. Very limited use of pointers and large data types (it has to compile on an eight bit microcontroller).
Follow C standard closely but add a few features that are useful to an embedded developer.
Easy configurability for any platform and option combination.
This is just an alpha / beta version. The project has been compiled and tested on an 8051 and Linux (so far). If you like it, find it useful, or have suggestions or changes, please email me at the address above.
A test script is included: e_test. Using the following commands, you should be able to try out the project on Linux:
$ make$
./e_test
Alternately, you can invoke the code directly on the command line with something like the following:
$ ./ep 16 i
"abc = %+6i" 2341