printf and floats

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by g_mocken on Fri Jun 26 02:56:38 MST 2015

generally I am aware of stack size  and library selection issues when using printf with floats. Using lplink2 with 4370, I have no problems to print floats to either UART or to the console via semihosting.

But when I use the same code (or a minimal test project) on a custom board with 4074, it always runs into a HardFault. The stack trace is:

Thread [1] <main> (Suspended : Signal : SIGSTOP:Stopped (signal))
HardFault_Handler() at cr_startup_lpc407x_8x.c:371 0x228
<signal handler called>() at 0xfffffff9
fp_display() at 0x1488
__vfprintf() at 0x24c2
printf_char() at 0x1146
main() at Test_4074_board.c:41 0x326

In this case, I was linking with RedLib(semihost) and trying in main() to perform:

    DEBUGOUT("float: %f\r\n", 123.456f);

I also tried more complex variants (e.g putting this line into a FreeRTOS task that was created with a large stack size), but with no success on 4074.

Any help would be appreciated.