cancel
Showing results for 
Search instead for 
Did you mean: 

u_printf_float - where to set for C_Linker in STM32CubeIDE?

MFend
Associate III

When I compile, I get the following error:

The float formatting support (-u_printf_float)is not enabled from linker flags

I can't find Linker flags/Options/Settings for C - just for MCU G++ Linker. When I chose the option, it still didn't remove the error. It compiles, though and can be run.

0690X000009Xcm0QAC.jpg

19 REPLIES 19
Gpeti
Senior II

Just to clarify:

1) I made a mistake, it seems like newlib-nano does support float printf

2) the problem comes from the stack initialisation bug

This issue is discussed many times on different forums on the web but it's a bit confusing.

kurta999
Senior

I suggest to using this library instead of this linker option.

https://github.com/mpaland/printf

Try to use built-in pritf with RTOS, SWO tracing & floating point support. Good luck :D.

MFend
Associate III

but the _estack pointer is fine in the .ld file...

I saw all of the threads - but they don't seem relevant

/* Highest address of the user mode stack */

_estack = 0x20020000;  /* end of 128K RAM */

MFend
Associate III

The Problems tab is very convenient to see all bugs concentrated into a nice neat list...

MFend
Associate III

Are there any other directions for using this library? What settings do i need to set in the IDE?

If it is reliable I agree. But apparently it does not correspond to errors or warnings found by the build system.

If you are trying to print on SWV console I cannot help you since I was never able to make it work (on TrueStudio on STM32L4 few months ago I gave up, on STM32CubeIDE and STM32H7 there is a different issue for which I started a dedicated thread).

If you are trying to print in a UART console (via virtual com port or physical RS232), I think the only setup at IDE level is this "float printf" option, and apart from that implement __io_putchar or _write fucntion and configure UART, you can easily find how to do on the web.

Yuk117
Associate III

This problem is fixed in STM32CubeIDE ver.1.0.2.

Workaround in older version is to add "-u _printf_float" to MCU GCC Linker -> Miscellaneous -> Other flags.

0690X000009Yu2qQAC.png

MFend
Associate III

This worked.

thanks...

I'm going to update to the latest release...

Hello @MFend​ 

are you able to fix it? Is it working for you now?