PRINTF() and printf() on MIMXRT1170-EVKB?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

PRINTF() and printf() on MIMXRT1170-EVKB?

62件の閲覧回数
VassiliN
Contributor III

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. 

 

VassiliN_0-1727811834259.png

The output code, I tried to apply different formats, %d, %hX, %hd: 

VassiliN_1-1727811931200.png

Output result: 

VassiliN_2-1727811993543.png

 

SDK version 2.15.100 

MCUXpresso IDE v11.9.1 [Build 2170] [2024-04-19]

PuTTY v. 0.74.0.0.

Windows 10 Pro

0 件の賞賛
返信
2 返答(返信)

58件の閲覧回数
VassiliN
Contributor III

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. 

VassiliN_3-1727812665817.png

I did that and  the project stopped building with multiple linker errors: 

 

VassiliN_1-1727812503223.png

VassiliN_2-1727812561481.png

 

 

 

 

 

0 件の賞賛
返信

21件の閲覧回数
EdwinHz
NXP TechSupport
NXP TechSupport

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.

0 件の賞賛
返信