Redlib floating point support with MCUXpresso IDE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Redlib floating point support with MCUXpresso IDE

Redlib floating point support with MCUXpresso IDE

Many times I came across one issue while using Redlib in MXUXpresso IDE project. I like to provide some guidance here to match the proper solution that can help others.

Problem Statement :

printf or sprintf doesn't print anything or printing random characters while using Redlib library.

Reason :

When you are creating your project you may ask to choose the c/c++ library setting to select either of the c libray provided by IDE in Advanced project setting wizard.

If you have not checked the option "Redlib: Use floating point version of printf" (which will use the floating-point variant of printf) have tried to print the floating point value, You will end up with the problem mentioned above.

Solution :

You need to enable the floating support by modifying some preprocessor directives in "Defined symbols (-D)" wizard of your project. Path :  Your Project > properties > C/C++ Build > Setiings > Tool Settings > MCU C Compiler > Preprocessor. These are:

  • PRINTF_FLOAT_ENABLE - keep the directive value to "1"
  • SCANF_FLOAT_ENABLE - keep the directive value to "1"
  • CR_INTEGER_PRINTF - Undefine/Remove this directive
  • Click on Apply and close.

That is it. Now you will have your expected prints for floating point values in your debugger console.

100% helpful (2/2)
Version history
Last update:
‎02-19-2019 06:34 AM
Updated by: