MCUXpresso SDK sprintf function

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MCUXpresso SDK sprintf function

跳至解决方案
1,967 次查看
kk7xo
Contributor III

I'm using the SDK for the LPCXpresso845MAX board  I would like to use sprintf() but I see that it is not included in the SDK.  I see that in your devices/LPC845/utilities/debug_console_lite directory you have a files named fsl_debug_console.c/h.  I like using this driver because it provides a printf() function I can use with my UART. 

However, I notice that you declare DbgConsole_PrintfFormattedData() (line 605 in my copy) as static, which means I cannot access it from outside the file.  This is unfortunate because I could easily use that function to create a sprintf() by passing in a pointer to a function that writes to a character string.

Since I cannot do that and I do not want to alter my copy of the SDK, I am forced to include the libnano version of sprintf(), which drags in a bunch of unwanted library functions such as malloc() and free() that compete with my own versions.

I would ask that you make DbgConsole_PrintfFormattedData() non-static in future versions of the SDK so we can access its functionality from our code without modifying the SDK files themselves.

Regards,

Albert

0 项奖励
回复
1 解答
1,961 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Albert,

Thanks for your sharing.

Just kindly reminder, you can create PRINTF by Config Tool:

Alice_Yang_0-1647504731268.png

BR

Alice

 

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,955 次查看
kk7xo
Contributor III

Yes I realize I can get printf.  It's sprintf that I'm looking for. 

I don't want to edit my copy of fsl_debug_console.c/h to make the necessary function accessible externally, otherwise my changes will get overwritten whenever I update my copy of the SDK.

0 项奖励
回复
1,948 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

OK, I know your meaning, and will submit request to SDK team, thanks for your suggestion.

 

BR

Alice

0 项奖励
回复
1,962 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Albert,

Thanks for your sharing.

Just kindly reminder, you can create PRINTF by Config Tool:

Alice_Yang_0-1647504731268.png

BR

Alice

 

0 项奖励
回复