AnsweredAssumed Answered

arm-none-eabi conflicting with mqx: multiple definitions of stdio.h and others causing compiler problems.

Question asked by Sean MacKay on Apr 21, 2015
Latest reply on Apr 21, 2015 by Sean MacKay

I'm working with KDS 1.1.0 and KSDK 2.0.0, trying to port a previous project from MQX 4.1.0 and CodeWarrior 10.6. I'm using C on a Freescale FRDM-K64F board.


I followed the guide at to make a new KDS project running and compiling. Then I tried to emulate the steps to add the RTCS and MFS projects. After copying over some of my own code and adding some of the library includes I need (mqx.h, lqmsgq.h, mfs.h) and then I get errors for Multiple definition of __dso_handle, _init,_fini in comp.c.


D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx/lib_mqx.a(comp.o): In function `_exit':
D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m/compiler/gcc_arm/comp.c:65: multiple definition of `__dso_handle'
d:/freescale/kds_2.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.0/m4/fp/v4-sp-d16/crtbegin.o:(.data.__dso_handle+0x0): first defined here
D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx/lib_mqx.a(comp.o): In function `toolchain_startup':
D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m/compiler/gcc_arm/comp.c:75: multiple definition of `_init'
d:/freescale/kds_2.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.0/m4/fp/v4-sp-d16/crti.o:(.init+0x0): first defined here
D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/lib/frdmk64f.kds/debug/mqx/lib_mqx.a(comp.o): In function `_fini':
D:/Development/13214-ELMU/trunk/Freescale/KSDK_1.1.0/rtos/mqx/mqx/source/psp/cortex_m/compiler/gcc_arm/comp.c:85: multiple definition of `_fini'
d:/freescale/kds_2.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.0/m4/fp/v4-sp-d16/crti.o:(.fini+0x0): first defined here
collect2.exe: error: ld returned 1 exit status


It looks like some of the standard library definitions in the PSP code are conflicting with the definitions in the arm-none-eabi code.ns,


As well, when I go to find stdio.h, I can find two versions, one in KSDK_1.1.0\rtos\mqx\mqx_stdlib\source\include\stdio.h, and the other in KDS_2.0.0\toolchain\arm-none-eabi\include\stdio.h.



This thread about C++ support(EWL C++ in MQX.), and a similar conflict with EWL and C++ shows that a lot of the MQX functions need to be redefined to MQX specific versions where conflicts arise. Is this the same situation now? I seem to remember that MQX had all MQX specific functions and structures in the previous MQX 4.1.0 and CW implementation. Has this changed? Do I need to modify the sources in the MQX libraries to remove the conflicts? Is there something I'm doing wrong in my project settings or compile process that might be leading to these conflicts?