Hi -
I am getting started with CW. I can build and run a C program for MCF51AC256, but unable to get a C++ program to find standard libraries. What do I have to include to get iostreams, etc, to be found by CW and built into the image? There just doesn't seem to be any information I can find in the documentation. Would someone point me to the appropriate documents or let me know what settings I need to get a project to build with C++ libraries?
Thanks
John Babrick
I'm having the same problem with the K60 processor. I'm also looking for documentation. If anyone can help point me in the right direction, it would be greatly appreciated.
Thanks
Steve Kerr
Hi All,
FYI - Next mid-month we will release MQX3.8 that will have C++ MQX example.
Regards,
David
Update as of October 27th, 2011. I can get CW 10.1 with updates and MQX 3.7 to compile, build and debug/run a simple C++ program on the Tower MCF51CN. It is a quirky little system, but it does work so far. It took me three weeks of struggling to get it running. Lots of conflicting and/or out of date instructions.
I still don't know quite how to include iostreams, etc, but I am working on that. I am hoping that the 3.8 update will show how to setup to use the standard C++ libraries - this is an issue that is not well addressed in the instructions.
My thanks to those who helped.
Is there any hope of bringing the rest of us up to speed with what you found?
JPA
Modify the user_config.h file to add
#define BSPCFG_ENABLE_CPP 1
recompile the MQX libraries (in CW) - the bsp, psp, rtcs, mfs, shell, etc.
When building your project, in CW, right click the project in the project pane and select
properties/ c/c++ build /settings/Coldfire Compiler/Language Settings and check (at least) Force C++ Compilation (there may be more things to check but I haven't gotten that far yet.
You should be able at that point to build a C++ project that does not use the C++ standard libs (i.e, but you can use c standard libs, printf). I haven't figured out yet how to get the C++ standard libs to compile, or waht exactly needs to be included - I get errors when I try to compile something with <iostream> in it.
I have a TSR in to Freescale to see if they will explain what I need to do to get this working.
Here is where I am at: I can either
1) Build and run a C++ program using standard libs but not with MQX
-or-
2) I can build and run an MQX programthat doesn't use C++ standard libs.
Option (1) results when I use the CW wizard for a bareboard project for MCF51CN128 and then load and run it on the Tower board. Unfortnuately, the console IO dribbles out of the OSBDM/OSJTAG USB port very slowly. I don't know how to get the IO to come out of the serial board's port.
Option (2) results when I use the CW wizard to produce a Tower evaluation board for MQX. The console IO goes out of the serial port on the serial board, but I cannot get any calls to the C++ standard libs to build.
I don't really "need" MQX but I should be able to use it, and I should be able to use it with C++. We need better documentation for how to configure the development environment correctly. I don't know which EWL libraries need to be included or which macros need to be defined. I sure wish Freescale would provide this info!
John,
Thanks for the information!
For C++/MQX, did you make any changes to the .lcf files ? It seems to be wanting __heap_addr and __heap_size which are missing from the MQX lcf files.
I've hacked something in, but not with any certainty. There's also a message about __cxa_end_catch and __cxa_call_unexpected. I don't use exceptions.
JPA
I didn't do anything yet to the C++/MQX project's .lcf file. I don't know what to do.
I am *really* *really* hoping that Freescale will provide updated and complete instructions on how to use C++ with MQX in the 3.8 release, which I am lead to believe will be "soon".
I'm with you about the MQX 3.8 release. Here's hoping they've fixed lots of bugs, too.
The linker problem (and solution) is discussed at
https://community.freescale.com/message/89716#89716
The danger, of course, is that it's easy to implement and then forget it for the next project.
JPA