Is anyone building C++ apps with the KSDK 1.1.0 and MQX?

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

Is anyone building C++ apps with the KSDK 1.1.0 and MQX?

Jump to solution
1,391 Views
dave408
Senior Contributor II

I've got a project that I want to write in C++ because I'm porting over from mbed, and I prefer C++ to C.    I'm using a FRDM-K64F.

 

I am basing the foundation of my application on the httpsrv example project.  I have gotten httpsrv to build fine.  However, in order to enable C++, I had to create the application from scratch because httpsrv was written for KDS 1.x and when importing into KDS 2.0, it does not expose the GCC C++ compiler settings.  I have read and been told elsewhere to start a new project from scratch, so that's what I did.

 

While the old httpsrv example worked with the compiled libraries (RTCS and MQX are working), the new one I created does not link.  I am at a point where the linker reports a lot of undefined references, and it seems that I have a name mangling problem.  I've had no luck so far recompiling the KSDK using g++.

 

So has anyone else out there built a C++ application using KSDK 1.1.0 and MQX for their Kinetis processor?  If so, can you please suggest any good rules of thumb for making it work?  I think my approach of trying to link to precompiled libraries is not going to work, and next I'm going to just include the all of the relevant KSDK projects in my C++ application as virtual folders to try to get around the problem.

Labels (1)
0 Kudos
1 Solution
870 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Dave408,

The KSDK 1.2 is going to be released in April, so it won't be very far to have this release . Thanks for your patience!


Have a great day,
Kan

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

View solution in original post

0 Kudos
12 Replies
870 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Dave408,

The driver of KSDK 1.2 support C++ toochain such as gcc/iar/keil,  though we don't have C++ library project for drivers, customer may build a custom C++ project with KSDK driver code from ver 1.2.0 on.


Hope that helps,


Have a great day,
Kan

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

0 Kudos
870 Views
dave408
Senior Contributor II

Hi Kan, thank you for responding to my question.  Could you please give me some more clarification about the C++ / KSDK support?  Are you saying that it is not possible *at all* to support C++ applications with KDS 2.0 + KSDK 1.1, or that it's just not set up "out of the box"?  I really would like to proceed with some basic C++ applications, and even if it requires a lot of configuration, I would appreciate it if you / Freescale can provide some guidance in that area.  If it is just not possible with KSDK 1.1, could you please explain why, as I think that would enhance everyone's understanding.

Thank you!

0 Kudos
870 Views
dave408
Senior Contributor II

Kan, I think I found what you might be referring to, but this is something I should be able to do by modifying the KSDK source and then recompiling.

Can you tell me when 1.2 is going to be released?

From the KSDK 1.1 release notes:

7.6 C linkage declaration

The KSDK is fully tested with all supported C compilers. However, the C linkage declaration for C++ compilers may not be done correctly. This will be fixed in the next KSDK release.

0 Kudos
871 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Dave408,

The KSDK 1.2 is going to be released in April, so it won't be very far to have this release . Thanks for your patience!


Have a great day,
Kan

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

0 Kudos
870 Views
dave408
Senior Contributor II

Hmm... that is really unfortunate.  Waiting 3 weeks (I assume which is the best-case scenario) is an eternity.  I might have to find another solution.  So you believe there really isn't any way to get my C++ application to work with the KSDK as it currently stands, even with local modifications to the library?

0 Kudos
870 Views
Kan_Li
NXP TechSupport
NXP TechSupport

I don't think current version supports C++ because I was told there are some issues on C++ compiling, which are fixed in version 1.2. Sorry for the inconvenience that has caused.


Have a great day,
Kan

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

0 Kudos
870 Views
dave408
Senior Contributor II

Thanks for your reply, Kan.  Would you mind inquiring about whether or not this is a C++ compiling issue in general, or something specific to the KSDK?  I'm asking because I'm fighting with a simple C++ project right now (I am admittedly very new to GCC and Eclipse), and I don't want to waste time trying to figure this out if it's an exercise in futility.  Thank you!

0 Kudos
870 Views
Kan_Li
NXP TechSupport
NXP TechSupport

It is some kind of C++ compiling issue in general, and actually, in 1.1, most of the drivers support C++ while we get building issues with a few of them, and the issue is something like not correctly adding " #if _cplusplus... extern .." in some header files, so you will have compiling issue during C++ building , but 1.2 has fixed them to correct format, so you won't have such trouble with C++ building any more.


Hope that makes sense,


Have a great day,
Kan

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

0 Kudos
870 Views
dave408
Senior Contributor II

Ok, never mind, I figured it out.  :smileyhappy:  I found that the new project wizard doesn't put the CPU preprocessor definition in the C++ compiler settings.  Once I added that, my test app worked fine.

0 Kudos
870 Views
dave408
Senior Contributor II

Hi again, Kan!  By any chance do you have a sample C++ project now that KSDK 1.2 has been released?

0 Kudos
870 Views
dave408
Senior Contributor II

Ok, that is kind of what I was expecting.  So then if I were persistent enough, I figure I can go through all of the header files and figure out where extern "C" needs to be used when using g++, right?  At least to get me going until the official 1.2 KSDK is released...

0 Kudos
870 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Yes, exactly.


Have a great day,
Kan

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

0 Kudos