Need Float output for printf Posted by ZrakSystems on 2015-08-08 19:22 I have read that the floating point outputs for printf is turned off by default. How do I turn it on?
Posted by rreignier on 2016-08-27 16:10 Hello, I know that this thread is one year old, but to give an answer for other people that are looking for the answer, I will give it. By default the float support is disabled. To enable it, add the linker flag: "-u _printf_float" in your project properties: Properties -> C/C++ Build -> Settings -> MCU GCC Linker -> Miscellaneous -> Linker flags
Posted by Arielo on 2017-09-28 00:45 Hello, I'm asking you directly because you seem to know your way around OpenSTM32. I've added the configuration that you posted, and it worked great, but compiling memory took up an extra 15kByte or so of memory just so the printf + float would work. Do you know of any workaround that takes up less memory? Or I should write my own code to printf float numbers to save rom memory? Regards, Arielo
Posted by samf48 on 2016-12-12 18:05 Very helpful @rreignier! I was fighting with printing floats for a while before I ran across this. Making my own "Printfloat" ended up being less accurate than enabling that flag. I included a screenshot to go along with your answer. u_print_float.png (87.55 Kb)
Posted by Zogras on 2017-08-14 21:33 Hello! There was the same need as in the topic starter. After installing this flag, the output stopped working at all. What is wrong?