Hi Martin,
Thanks for your help. I am the customer mentioned above :smileyhappy: I am using CW 10.6 and MQX 4.1. I started from scratch following the instructions from this thread. I've got it almost working, but I have another linker problem.
I followed the instructions from https://community.freescale.com/message/393786#393786 and changed user_config.h and the macro definitions. Afterwards, I rebuilt BSP and PSP successfully. Then I created a new MQX 4.1 project with the "cplus" example.
When changing the directories for the C++ compiler as described here, I noticed that in the automatically generated project, the directories contain "GCC" instead of EABI.
Therefore I changed (I hope that's OK)
${MCUToolsBaseDir}/ARM_EABI_Support/ewl/EWL_C++/include
to
${MCUToolsBaseDir}/ARM_GCC_Support/ewl/EWL_C++/include
The project derived from "cplus" now builds fine. I can even use STL classes like std::map or std::string, hooray!
However, when I add
#include <iostream>
to cplus.cpp, there are linker errors:
**** Build of configuration twrk60f120m_Int_Flash_Debug for project cpp41 ****
"C:\\Freescale\\CW MCU v10.6\\gnu\\bin\\mingw32-make" -j8 all
'Building file: ../Sources/cplus.cpp'
'Executing target #1 ../Sources/cplus.cpp'
'Invoking: ARM Ltd Windows GCC C++ Compiler'
"C:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-g++" "../Sources/cplus.cpp" @"Sources/cplus.args" -Wa,-adhlns="Sources/cplus.o.lst" -MMD -MP -MF"Sources/cplus.d" -o"Sources/cplus.o"
'Finished building: ../Sources/cplus.cpp'
' '
'Building target: cpp41.elf'
'Executing target #2 cpp41.elf'
'Invoking: ARM Ltd Windows GCC C++ Linker'
"C:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-g++" @"cpp41.args" -o"cpp41.elf"
In file included from C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/EWL_C++/include/lib_ewl_c++.prefix:12:0,
from <command-line>:0:
C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/EWL_C/include/lib_ewl.prefix:16:0: warning: "_EWL_C99" redefined [enabled by default]
../Sources/cplus.cpp:46:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/lib/armv7e-m\libstdc++.a(iostream.o): In function `std::char_traits<wchar_t>::copy(wchar_t*, wchar_t const*, unsigned int)':
ARM_GCC_Support/ewl/EWL_C++/../EWL_C++/include/char_traits:246: undefined reference to `wmemcpy'
C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/lib/armv7e-m\libuart.a(uart_console_io.o): In function `__init_uart_console':
ARM_GCC_Support/ewl/EWL_C/src/sys/uart_console_io.c:200: undefined reference to `InitializeUART'
C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/lib/armv7e-m\libuart.a(uart_console_io.o): In function `__read_console':
ARM_GCC_Support/ewl/EWL_C/src/sys/uart_console_io.c:93: undefined reference to `ReadUARTN'
C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/lib/armv7e-m\libuart.a(uart_console_io.o): In function `__init_uart_console':
ARM_GCC_Support/ewl/EWL_C/src/sys/uart_console_io.c:200: undefined reference to `InitializeUART'
C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/lib/armv7e-m\libuart.a(uart_console_io.o): In function `__write_console':
ARM_GCC_Support/ewl/EWL_C/src/sys/uart_console_io.c:151: undefined reference to `WriteUARTN'
mingw32-make: *** [cpp41.elf] Error 1
I guess I need to override the functions __read_console, __write_console etc. Therefore I copied console_to_mqx.c from your example project into my project. In this file, the function __write_console is defined. However, the linker error stays the same - I expected the last error regarding __write_console to disappear. Can you help?
Kind regards
Michael