I am using the K60 with MCUxpresso. The printf command works, but won't print floats. I've had this before, so I know to delete the CR_PRINTF_INTEGER from the preprocessor list. I've done that, and also PRINTF_FLOAT_ENABLE is set to 1. The Quick start menu Quick Settings >> Set floating point type list is all grayed out.
Not unrelated, I am also getting compiler errors that the code is using floating point commands for a unit that doesn't have floating point.
Any ideas?
Solved! Go to Solution.
Although I would have bet money that I had selected the floating point printf option when I created the project, I created a new project, making doubly sure to select floating point printf, then copied and pasted all the old code into the new project. The compiler errors disappeared, and the program runs and prints floats just fine.
For anyone else reading this to fix a similar problem, I should have mentioned that I am using redlib. I've come to the conclusion that there is some piece of MCUxpresso that controls the use of floats, that is not changed by messing with the pre-processor list. Whatever it is is only set by ticking the box for floating point printf at project creation time. I haven't used neolib, it may be completely different.
Thanks for your help, Erich. I'd say stay safe, but judging by Switzerland's Covid-19 stats, that won't be a problem.
Hello,
it depends on the library you are using. See printf() and scanf() with GNU ARM Libraries | MCU on Eclipse , for the GNU nano lib you have to turn things on in the linker:
I hope this helps,
Erich
Although I would have bet money that I had selected the floating point printf option when I created the project, I created a new project, making doubly sure to select floating point printf, then copied and pasted all the old code into the new project. The compiler errors disappeared, and the program runs and prints floats just fine.
For anyone else reading this to fix a similar problem, I should have mentioned that I am using redlib. I've come to the conclusion that there is some piece of MCUxpresso that controls the use of floats, that is not changed by messing with the pre-processor list. Whatever it is is only set by ticking the box for floating point printf at project creation time. I haven't used neolib, it may be completely different.
Thanks for your help, Erich. I'd say stay safe, but judging by Switzerland's Covid-19 stats, that won't be a problem.