lpcware

CR_PRINTF_CHAR functionality broken ?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by robert hulsebos on Thu Dec 17 13:07:20 MST 2015
Hello all,

We have a working application for the LPC1769 MCU that was originally built with LPCXpresso v7.4.0. It uses the CR_PRINTF_CHAR symbol to force printf output on a character-by-character base to a console UART.
See https://www.lpcware.com/content/faq/lpcxpresso/using-printf for details. The CR_PRINTF_CHAR is explicitly defined file as it prevents printf() from using heap functions like malloc(), etc.
Because our application is to be MISRA-C compliant, use of heap functions is not allowed. We defined our own __sys_write() function to do UART output and all worked fine.

Then we switched to LPCXpresso v7.9.2 and suddenly console output is gone. Input seams to work OK. Setting a breakpoint at function _sys_write() learned that this output function is still called, but only once, during startup. If we remove the CR_PRINTF_CHAR symbol from our project, then console output is back to normal again. Input and output. So it looks that somewhere between v7.4.0 and v7.9.2 the CR_PRINTF_CHAR functionality was broken...
I am not able to pinpoint the source of the problem (GCC/LPCXpresso/RedLib), as I do not have the source code of the C run-time library -  debugging its assembler code is rather cumbersome...  Any suggestions?

Outcomes