Hi:
In previous topics there are some discussions how to print float number in MCUXpresso IDE and SDK.
To try them and summarize the final solution:
1.PRINTF the float number to UART console
set below macro in project configuration->C/C++ build ->setting
PRINTF_FLOAT_ENABLE=1
such code will work.
float test1 = 0.15;
PRINTF("%f\r\n",test1);
2.Transform float number to string by sprintf() function.
there is one error in SDK user manual, " Ensure Redlib: Use floating point version of printf is selected
" during project creation does not work.
The default C library Redlib doesn't support floating, so it couldn't work with redlib.
The correct solution are:
(1)Change link library to NewLib, it's full C library and support float printf.
But notice need include <stdio.h> in related c file, or else sprintf(float) doesn't work as expected.
(2)Change link library to NewLib Nano, it's compact C library , and need click "enable print float" to enable float function, which actually add " -u _printf_float" link symbol.
But notice need include <stdio.h> in related c file, or else sprintf(float) doesn't work as expected.
So the solution surely add flash & RAM consumption in project, but for i.MXRT series it's not problem.
Attach is one example for RT1020 EVK.