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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

651 Views
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

Labels (1)
0 Kudos
3 Replies

382 Views
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 Kudos

382 Views
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 Kudos

382 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

OK ! :smileyhappy:

0 Kudos