I need to output some debug data from the MIMXRT1170-EVKB.
I tried to use PRINTF() and it gives me some troubles with negative values.
I am using UART as a debug console.
Data type is int16_t, so when I see the negative values in debugger, the data seems to be expanded to unsigned 32 bits before being output to the UART.
The output code, I tried to apply different formats, %d, %hX, %hd:
Output result:
SDK version 2.15.100
MCUXpresso IDE v11.9.1 [Build 2170] [2024-04-19]
PuTTY v. 0.74.0.0.
Windows 10 Pro
So, I looked for the solution here:
https://community.nxp.com/t5/MCUXpresso-SDK/Simple-printf-formatting-not-working/m-p/1244449#M3098
It recommends to use PRINTF_ADVANCED_ENABLE=1 in the project settings.
I did that and the project stopped building with multiple linker errors:
Hi @VassiliN,
I was able to reproduce the initial issue where the negative sign was lost, and in my case, I was able to fix it using the PRINTF_ADVANCED_ENABLE=1 macro definition without any linker errors.
Could you try changing the library as to Newlib as recomended on the following community post?: LPC54628 Printf Floating numbers doesnt have minus sign - NXP Community.
BR,
Edwin.