AnsweredAssumed Answered

KDS printf issues with -nanolibc

Question asked by Derek Snell Employee on May 27, 2014
Latest reply on Jul 14, 2014 by Derek Snell



I've run into an issue with KDS when using the nanolibc library and printf.  With this library, the printf only prints the first character.  If I remove the linker option -nanolibc, then printf works as expected.


I'm using the attached project for the FRDM-K64F Freedom board.  I've used Processor Expert (PEx) to add MQX Lite and the ConsoleIO component.  The attached project uses the option -nanolibc, and shows the issue.  Debugging the issue, I put a breakpoint in the function _write() generated by the ConsoleIO component in CsIO1.c.  The parameter count for the character count to send out the UART is set to 1 when -nanolibc, no matter what the length of the printf string is.  If I remove the linker option -nanolibc and debug, the character count is passed correctly as expected.


I haven't figured out how to debug the library for why the count parameter is 1, since I haven't found the library source code yet.


I found this when trying to use a device with less RAM than the K64.  In that device, using the default library didn't fit in the RAM, so I used the -nanolibc option for the smaller library.  Now the application fits, but I can't get the printf statements to work.


Thanks for any guidance




Original Attachment has been moved to: