2017-05-22 05:13 AM
Hello,
I would like to print floating variable with printf but it is not working. i'm using a stm32l073 MCU that does not have any FPU. I'm activating
-u _printf_float
in my llinker but it doest not change anything. All other type are working well. If someone knows how to solve my issue, please feel free to share your solution.Best regards,
Aurélien
2017-05-22 05:30 AM
The FPU is not really helpful for printf(), i.e. generating an ASCII string from a float/double number.
I guess you have the 'wrong' library. Libraries optimized for size often come with a scaled-down printf/scanf, which does not support the float format.
Check with your toolchain and project settings.
2017-05-22 05:32 AM
remove nano.specs from your linker options
2017-05-24 05:26 AM
Hello
@john doe : i removed 'nano.specs' from linker option but it does not have changed anything in spite of that, now, the MCU is no longer raising an exception, but it is printing wrong characters. When i let 'nano.specs' + '
-u _printf_float',
the MCU raises a hardfault exception.
@AvaTar : i will check my toolchain, i'm maybe missing something,
2017-05-24 08:18 AM
The 'nano.specs' thing is toolchain specific.
But the idea is basically correct, the 'nanolib' version of the clib uses to have a printf without floating point format support.