Hello,
I'm using KDS 2.0, KDSK1.1.0, PEx, with the FRDM-K64F. I'd like to print the Floating point accelerometer values to the terminal using fsl_debug_console. Strings and integers print fine but it seems debug_printf() doesn't support float. I also tried
sprintf(str,"%f");
printf("%s",str);
but everything except the floating point val would print. Is there a compiler setting that must be changed to support floating point printing?
Thanks,
Michael
已解决! 转到解答。
Hello Michael,
To print floating point values, you need to enable float/double support to printf() function. In KDS, please look under: Properties->C/C++ Build->Settings->Tool Settings->Cross ARM C Linker, then add
-u _printf_float to the linker options. It will be OK.
For example, you can write code like this:
float temp=36.5;
printf("\r\n temp=%f \n\r",temp);
Hello Michael,
To print floating point values, you need to enable float/double support to printf() function. In KDS, please look under: Properties->C/C++ Build->Settings->Tool Settings->Cross ARM C Linker, then add
-u _printf_float to the linker options. It will be OK.
For example, you can write code like this:
float temp=36.5;
printf("\r\n temp=%f \n\r",temp);
Hi Dave,
I went to Properties->C/C++ Build->Settings->Cross ARM C Compiler->Miscellaneous then in the "Other compiler flags" box I added "-u_printf_float". That seemed to work for me. Are you using KDS, KSDK, and PEx with the FRDM-K64F?
Thanks,
Michael
This is so odd. Setting the compiler flags didn't work for me, either. I'm using KDS 2.0, KSDK 1.1, and MQX. I am not using processor expert. This is with a K64F. I just found a post by Erich Styger, so I'll check that out now. Thank you for your prompt reply!
Ok, I'll definitely post my findings if anyone else presents a solution elsewhere. Erich's post mentions linker settings as well, not compiler settings. It also has a lot of detail that I'm not comfortable with, and since it mentioned PEx and not KSDK, I'm not sure it's the right direction for me. I'll keep digging, and if I can't find the answer, I'll post up a new thread and link to it here. Thanks!
Ok, thanks! That's totally not what Ke had said. :smileyhappy: He specifically mentioned the linker, but hey it didn't work and you got it working, so I'll try your suggestion. Thank you!