Unable to print float values using PRINTF() in i.MX93EVK

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

Unable to print float values using PRINTF() in i.MX93EVK

Jump to solution
828 Views
Vikas7Bal
Contributor II

I am working with an imx93evk sdk_2_16 (I am not sure how I generated it, will provide the generation steps in next post).

I observed that, the "PRINTF()" function is not able to print float values (it will only print textual content and remains blank in the place of float values)

I read in this query that, I need to enable some macros during project generation, but since my project is already generated, I couldn't regenerate it (there are many untracked changes which will be lost if I rebuild again)

So, is there a way where I can modify in the source code, so that I can achieve this. (I tried enabling the PRINT_FLOAT_ENABLE macro but yet it is not working)

This is the configuration, I currently have :
PRINT_FLOAT_ENABLE = 1
SDK_DEBUG_CONSOLE = 1

Thanks!

Labels (1)
0 Kudos
Reply
1 Solution
776 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

How did you modify your source code?

Please try to define these flags before fsl_debug_console.

// main.c
#define PRINTF_FLOAT_ENABLE 1
#define SDK_DEBUGCONSOLE 1

#include "fsl_debug_console.h"

 

If not work, then try to  modify LDFLAGS

-Wl,-u,_printf_float



Best Regards,
Zhiming

View solution in original post

0 Kudos
Reply
2 Replies
777 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

How did you modify your source code?

Please try to define these flags before fsl_debug_console.

// main.c
#define PRINTF_FLOAT_ENABLE 1
#define SDK_DEBUGCONSOLE 1

#include "fsl_debug_console.h"

 

If not work, then try to  modify LDFLAGS

-Wl,-u,_printf_float



Best Regards,
Zhiming

0 Kudos
Reply
717 Views
Vikas7Bal
Contributor II
Hi, Zhiming thanks for your quick response!

I have tried defining those flags before fsl_debug_console.h, but still no luck with it

However, I have tried -Wl,-u,_printf_float this linker flag and it started working!

Thanks!
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2078853%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EUnable%20to%20print%20float%20values%20using%20PRINTF()%20in%20i.MX93EVK%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2078853%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%3EI%20am%20working%20with%20an%20imx93evk%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Esdk_2_16%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B(I%20am%20not%20sure%20how%20I%20generated%20it%2C%20will%20provide%20the%20generation%20steps%20in%20next%20post).%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EI%20observed%20that%2C%20the%20%22%3C%2FSPAN%3E%3CSTRONG%3EPRINTF()%3C%2FSTRONG%3E%3CSPAN%3E%22%20function%20is%20not%20able%20to%20print%20float%20values%20(%3C%2FSPAN%3E%3CSTRONG%3Eit%20will%20only%20print%20textual%20content%20and%20remains%20blank%20in%20the%20place%20of%20float%20values%3C%2FSTRONG%3E%3CSPAN%3E)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EI%20read%20in%20this%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FMCUXpresso-IDE%2FPrintf-won-t-print-floats%2Fm-p%2F1093045%23M6046%22%20target%3D%22_self%22%3Equery%3C%2FA%3E%3CSPAN%3E%26nbsp%3Bthat%2C%20I%20need%20to%20enable%20some%20macros%20during%20project%20generation%2C%20but%20since%20my%20project%20is%20already%20generated%2C%20I%20couldn't%20regenerate%20it%20(%3C%2FSPAN%3E%3CSTRONG%3Ethere%20are%20many%20untracked%20changes%20which%20will%20be%20lost%20if%20I%20rebuild%20again%3C%2FSTRONG%3E%3CSPAN%3E)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3ESo%2C%20is%20there%20a%20way%20where%20I%20can%20modify%20in%20the%20source%20code%2C%20so%20that%20I%20can%20achieve%20this.%20(I%20tried%20enabling%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EPRINT_FLOAT_ENABLE%26nbsp%3B%3C%2FSTRONG%3E%3CSPAN%3Emacro%20but%20yet%20it%20is%20not%20working)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EThis%20is%20the%20configuration%2C%20I%20currently%20have%20%3A%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSTRONG%3EPRINT_FLOAT_ENABLE%20%3D%201%3CBR%20%2F%3ESDK_DEBUG_CONSOLE%20%3D%201%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3CSPAN%3EThanks!%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2078853%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EDevelopment%20Board%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2083233%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Unable%20to%20print%20float%20values%20using%20PRINTF()%20in%20i.MX93EVK%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2083233%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHi%2C%20Zhiming%20thanks%20for%20your%20quick%20response!%3CBR%20%2F%3E%3CBR%20%2F%3EI%20have%20tried%20defining%20those%20flags%20before%20fsl_debug_console.h%2C%20but%20still%20no%20luck%20with%20it%3CBR%20%2F%3E%3CBR%20%2F%3EHowever%2C%20I%20have%20tried%20-Wl%2C-u%2C_printf_float%20this%20linker%20flag%20and%20it%20started%20working!%3CBR%20%2F%3E%3CBR%20%2F%3EThanks!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2079771%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Unable%20to%20print%20float%20values%20using%20PRINTF()%20in%20i.MX93EVK%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2079771%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3CBR%20%2F%3E%3CBR%20%2F%3EHow%20did%20you%20modify%20your%20source%20code%3F%3C%2FP%3E%0A%3CP%3EPlease%20try%20to%20define%20these%20flags%20before%26nbsp%3Bfsl_debug_console.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%2F%2F%20main.c%0A%23define%20PRINTF_FLOAT_ENABLE%201%0A%23define%20SDK_DEBUGCONSOLE%201%0A%0A%23include%20%22fsl_debug_console.h%22%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CBR%20%2F%3E%0A%3CP%3EIf%20not%20work%2C%20then%20try%20to%26nbsp%3B%20modify%20LDFLAGS%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E-Wl%2C-u%2C_printf_float%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EBest%20Regards%2C%3CBR%20%2F%3EZhiming%3C%2FP%3E%3C%2FLINGO-BODY%3E