CW10.5 c++ config, Kinetis and MQX4.1

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

CW10.5 c++ config, Kinetis and MQX4.1

839 Views
DavidS
NXP Employee
NXP Employee

Hello,

I'm submitting this for a customer as I am not expert with C++ project in CW10.5 with MQX:

I'd like to know the proper configuration for a C++ and MQX project (preferably with 2009 C++).  I'm having a problem with I/O and printf (and related).   I'm getting an undefined reference to __pformatter, and when I start chasing this, it leads to UART symbols.   Here is a simple example to see the problem.

 

 

  •         Start with the cplus example in MQX 4.1 and change it to C+2009 ( gnu extensions).

 

  •         Replace cplus.cpp with the one enclosed (only two lines changed).

 

  •         Add the two additional files to the project.   Nothing MQX specific in these.

 

  •         Compile.

 

If I modify the source of cmds_memory.cpp to include mqx.h and fio.h in place of cstdio, then all is well (except I have to remove the std:: namespace on printf and sprint).

 

What is the proper configuration here?  Is there a configuration supporting the standard  be avoided in favor of mqx.h/fio.h.  I'm concerned my C++ environment configuration is not correct.

 

Regards,

David

 

David Seymour

Freescale FAE

Dallas, Tx

1-(469)-400-5345

Please attend:

FTF Americas

April 8-11, 2014

Gaylord Texan Resort & Convention Center

Dallas, Texas

http://www.Freescale.com/FTF

Original Attachment has been moved to: commands.h.zip

Original Attachment has been moved to: cplus.cpp.zip

Original Attachment has been moved to: cmds_memory.cpp.zip

Labels (1)
0 Kudos
2 Replies

242 Views
trytohelp
NXP Employee
NXP Employee

Hi David,

I'm using TWR-K70F120M board under MCU V10.5 with MQX V4.1.

I've plugged the TWR-SER to a RS232/USB adaptor which is plugged on my PC through USB Port.

I've created a new project based on MQX V4.1 Cplus project.

I've rebuild the MQX libraries according to the Cplus project requirement.

The application is working fine and the Terminal shows:

++++++++++++++

global: Constructed OK

local: Constructed OK

heap: Constructed OK

heap: deallocation

local: deallocation

++++++++++++++

By default the Language Standard is defined by:

      Compiler Default (ISO 1998 C++ with GNU extensions).

1- I changed it to ISO 2009 C++ with GNU extensions (-std=gnu++0x).

      -> the application is running fine too.

2- added your files (3 files).

      -> I got 2 errors.

By default the MQX project is using its own printf definition which is defined in fio.h file.

If I'm right you added a file cmds_memory.cpp which is not using the printf definition of MQX but EWL definition.

Is it the issue ?

Regards

Pascal

0 Kudos

242 Views
DavidS
NXP Employee
NXP Employee

Hi Pascal,

Thank you for your reply.

Sorry for me delay. I was at FTF America most of the week.

I will inquire to customer about mixing printf’s from MQX and EWL and get back to you.

Regards,

David

0 Kudos