u_printf_float - where to set for C_Linker in STM32CubeIDE?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-06-27 1:03 AM
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.
Solved! Go to Solution.
- Labels:
-
STM32CubeIDE
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-18 10:16 PM
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.
​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-08 2:35 AM
Where is LDFLAGS (linker flags) set?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-16 11:52 PM
I've been asked to introduce this new IDE to the other FW developers on our team.
I still have this float-printf problem .
Even after I choose the settings, I get the error...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-17 12:31 AM
The linker command shown in the console window:
arm-none-eabi-g++ -o 4040D_STM32Cube.elf Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal.o
...
...
Src\values_log.o startup_stm32l451xx.o -mcpu=cortex-m4 -TF:\work\FlameDetectors\4040D_STM32Cube\stm32l4_flash.ld --specs=nosys.specs -Wl,-Map=4040D_STM32Cube.map -Wl,--gc-sections -static --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -u _printf_float -u _scanf_float -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group
In the linker command I see that -u_printf_float is defined - and still I get the errors that printf doesn't support float!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-17 12:42 AM
You are using "newlib-nano" standard C library and it doesn't support float printf anyway. So even if you fix your compilation / link option issue, it will not work (for example a printf of a float will return 0.0000).
if I remember correctly (not sure though), "newlib" should support float printf.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-17 1:26 AM
Thanks for noticing that...
I changed the library to the regular C/C++ standard, and I still get the error. (I Rebuilt the whole project)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-17 1:40 AM
" It compiles, though and can be run" So it is a build error or not ? It's not clear. And can you printf float variables at the end ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-17 1:45 AM
I checked on a project of mine and there is indeed an error message in the Problems tab. To be honest I never look at this tab and I'm not sure it is reliable in this IDE.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-17 2:09 AM
As you've seen yourself - these errors are mentioned, but the project can be debugged.
I haven't been able to see the printfs in the SWV console - that's another thread that I opened in the forum...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-07-17 2:13 AM
There is the known bug about stack, see for example this thread:
https://community.st.com/s/question/0D50X0000AldaPzSQI/cubeide-sprintf-does-not-work-with-f
