Using lib_small_printf_m0

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by robert.palmer on Tue Jun 19 09:35:49 MST 2012
Ok,  I'm very well aware of the issues of using the RedLib or NewLib with printf support - it's too darned big for the LPC1114.  So, I WANT to use lib_small_printf_m0.  But I can't figure out how.

Does anyone know of or have a short tutorial or at least a basic set of steps that will allow me to use the lib_small_printf_m0 in both semihost mode and direct to UART?  Alternatively a sample project would be fine also.

I'm familiar with overriding the __write() in semihost to make it go to the UART.  I've done that in other projects.  I just can't seem to figure out what the lib_small_printf_m0 wants.

- What's the entry point?  The TEST_PRINTF shows using "printf()" but the library never defines printf(), only printf_format() and func_printf()

- do I need to define my own printf() and call the func_printf() or printf_format()?

- what is the difference between the two (func_printf() and printf_format())?

- is it possible to use the semihost and print the output to the host debug console, or can I ONLY print to a UART (or other physical hardware) using lib_small_printf_m0

I've searched the forum and other places for the answer, but there is no documentation on USING lib_small_printf_m0.

Thanks in advance.