Now that KSDK 1.2 is supposedly C++ compatible, I'd like to move my applications to C++. However, every time I generate code in PEx, it creates a C file instead of a CPP. Is there a setting somewhere? I've been looking around for any setting that might tell PEx that I want to make a C++ project, but I can't find one. For example, this is all I see in Project Settings -> Processor Expert:
I haven't really ever mixed C and C++ before. I am entirely in one language or the other. I would think that *everything* has to change, not just main. Since my tasks are intended to communicate with hardware via classes that I define, and since the tasks need to then be written in C++, that means all code that PEx generates (except the FSL HAL/DRV code) like MQX tasks also need to be generated as C++.
Has anyone here successfully created a KSDK/MQX/PEx C++ project that they can share as an example? There isn't anything like this in the installed demos and examples. I did find this post here Creating a new MQX project using GCC C++ that specifically talks about MQX and CodeWarrior, and I found the BSPCFG_ENABLE_CPP #define and changed it, but it didn't seem to change anything.
Solved! Go to Solution.
Through experimentation, it looks like you do not need to jump through the same hoops as described by past posts. I believe it boils down to renaming main.c and os_tasks.c, then regenerating code and then excluding those same .c files from the build.
Hello Dave,
The Processor Expert does not support generating C++ code (.cpp program modules). There is not any C++ options.
But you can use the generated code in your C++ applications (the generated code of drivers should be C++ compatible). See the following links for details (workarounds):
Use of Processor expert for a CPP project - Issue
Processor Expert, gcc C++ and Kinetis-L with MQXLite | MCU on Eclipse
Best Regards,
Marek Neuzil
Hi Marek, thank you for your response. I am okay with PEx not generating CPP files. The plan is to just write C++ wrappers. My main issue is specifically with MQX, and how I can enable my main.cpp to start MQX properly. I suppose the correct approach is to define as many tasks upfront as I believe are required (and maybe a couple of extra), then use PEx to generate the code, then do the MQX-specific instructions that BlackNight has recommended in the post you linked to (especially disabling of code generation). Thank you for your help!
By the way, would you mind taking a peek at my other question, which you had assisted me with in the past? I am having trouble figuring out where my problem is. lwIP project that was working in KDS 2.0 with MQX and PEx no longer works in KDS 3.0
Through experimentation, it looks like you do not need to jump through the same hoops as described by past posts. I believe it boils down to renaming main.c and os_tasks.c, then regenerating code and then excluding those same .c files from the build.