Has anyone been able to get printf to work in a C++ application?

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

Has anyone been able to get printf to work in a C++ application?

1,449 次查看
dave408
Senior Contributor II

I'm still working on getting KDS 2.0 to work with KSDK 1.1 with a C++ application.  I have started with the simplest of applications, which is basically what comes out of the new KDS Project wizard, the addition of all necessary include folders, the linker libraries, and a printf statement.  Whether I try printf or putchar, nothing goes to the serial port.  Instead, the program seems to reset over and over again.  In the screenshot below, if I hit F6 to single step over the printf, it ends up back at main.

 

 

If I don't use the printf and stick with the default behavior from the wizard (increment a counter), it works fine.

 

Has anyone had luck with this?  I've included my project here.  If anyone is willing to take a look at it and see if there's anything wrong, I would appreciate it!  You can import it by using File -> Import -> Project of projects.  Thanks!

Original Attachment has been moved to: SimplePrintfCpp2.wsd.zip

标签 (1)
标记 (6)
0 项奖励
回复
3 回复数

1,180 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Dave,

Please send your project , or it can't open your project.

And if you want to use printf() on KDS-KSDK, you can add the "fsl_debug_console" component .


Have a great day,
Alice

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,180 次查看
dave408
Senior Contributor II

Hi Alice, thanks for your reply.  I've shelved this project temporarily as it seemed to be related to the C++ project I was trying to use.  I gave up on C++ and am going to write my application in C instead.  If I run into printf problems again, I'll post a new question with a project that will hopefully open properly!

0 项奖励
回复

1,180 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

OK ! :smileyhappy:

0 项奖励
回复