Hello Team,
I am seeing an issue while printing double or float values.
I am using LPC55S69 custom board.
This is the IDE version used => MCUXpresso IDE v24.12
The library used => NewlibNano (no host)
I am able to print the debug messages using "PRINTF".
I tried to print value of double or float I am just seeing blank message on the console.
Later I just realized that, PRINTF_FLOAT_ENABLE needs to be set to 1, in order to print values of double or float. I set "PRINTF_FLOAT_ENABLE" to 1 in the LPC core.
But as soon I enabled the macro, none of the debug messages are displayed on the console.
I even tried enabling "Enable printf float" option, that also didn't help.
Just FYI, I have used these format specifiers -> %f, %lf, %.4Lf, %.4f
Also FYI, In the debug mode, I can able to see the values in that particular double variable, only issue is with printing.
Can someone please let me know, what is missing?
Regards,
San
解決済! 解決策の投稿を見る。
Hello @sushmasan,
I have successfully enabled float printing in your project. To achieve this, I made several configuration changes. Please review the following settings and apply them if needed:
In the LMC_target project:
Enable these options:
MCU C++ Compiler -> Preprocessor: Add the macro: __USE_CMSIS
MCU C Compiler -> Preprocessor: Add the macro: __USE_CMSIS
In the FreeRTOS_lib project:
Architecture & Headers: Set the option to: NewlibNano (auto)
Preprocessor: Remove the macro: PRINTF_FLOAT_ENABLE=0
In the FreeRTOS_lib project:
Architecture & Headers: Set the option to: NewlibNano (auto)
BR
Habib
Hello @sushmasan,
Please check if your project has the next configurations:
1. The macro called "SDK_DEBUGCONSOLE" enabled:
2. These options enabled:
3. The macro called "PRINTF_FLOAT_ENABLE" set to 1:
BR
Habib
Hi @Habib_MS ,
SDK_DEBUGCONSOLE was already enabled, and "Enable Printf Float" also.
Where as "PRINTF_FLOAT_ENABLE" I just enabled in fsl_str.h, but there is no impact with this.
With all above 3 changes, there is no change in the behavior, which means I am not able to print double value.
But there is one compiler option under settings, when this is set to 1, the code under this flag is getting enabled (Inside this function -> int StrFormatPrintf(const char *fmt, va_list ap, char *buf, printfCb cb))
As I already mentioned in my initial message, when I set "PRINTF_FLOAT_ENABLE" to 1 under settings, none of the PRINTF messages are displayed.
Regards,
San
Hello @sushmasan,
To better support you, could you please share your project? That way, I can take a closer look and better understand the issue you are encountering.
BR
Habib
Hello @sushmasan
I found that it is encountering a hardfault at the ASM instruction vldr d0, [r7, #48], as shown in the image below:
This instruction uses the FPU (Floating Point Unit) built into the core, which appears to be disabled. Please make sure that the FPU is correctly configured in your project, the function called "system_init" of CMSIS could be helpful with this issue. Please make sure that you declared the macro called __USE_CMSIS.
BR
Habib
Hello @Habib_MS ,
This "__USE_CMSIS " macro was already enabled. If you see the settings I have shared in my previous message you can see that macro.
When you say this "Please make sure that the FPU is correctly configured in your project, the function called "system_init" of CMSIS could be helpful with this issue. " what do you think might be missing?
Regards,
San
Hello @sushmasan,
I have successfully enabled float printing in your project. To achieve this, I made several configuration changes. Please review the following settings and apply them if needed:
In the LMC_target project:
Enable these options:
MCU C++ Compiler -> Preprocessor: Add the macro: __USE_CMSIS
MCU C Compiler -> Preprocessor: Add the macro: __USE_CMSIS
In the FreeRTOS_lib project:
Architecture & Headers: Set the option to: NewlibNano (auto)
Preprocessor: Remove the macro: PRINTF_FLOAT_ENABLE=0
In the FreeRTOS_lib project:
Architecture & Headers: Set the option to: NewlibNano (auto)
BR
Habib
Hello @Habib_MS ,
Thank you so much for your support.
I didn't realize that, the other dependent project pointing to RedLib library and I missed few build configurations too.
With these configuration changes, now I am able to print double value.
Regards,
San
Hello Team,
Can someone please check it and let me know what is missing?
Regards,
San