r0n9
r0n9

Reputation: 2759

Is it possible to use other C++ standard library implemention, Libc++ on MQX

I am new to MQX. The MQX I am using has its own standard library implementation. It does not support std::shared_ptr nor std::unique_ptr.

Is anyone successfully using another version (e.g the gnu version libc++) of STL instead of embedded warrior library on MQX 4.11?

Edit 1 Added more details about what I am trying to do

Currently, the project is using GNU Arm Embedded Toolchain (gcc-arm-none-eabi-5_4-2016-q2) but instead of using gnu standard library, the project is using EWL(embedded warrior library) which seems to stop updating for a very long time. So I am trying to use the gnu library to replace the EWL.

In the makefile, it has something like:

CPP_FLAGS += -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -foptimize-sibling-calls\
    -fno-strict-aliasing \
    -g2 -gdwarf-2 -gstrict-dwarf -std=gnu++14 -Wall -Wextra -Woverloaded-virtual -Werror -Wcast-align -Wfloat-equal \
    -Wformat-extra-args -Wformat -Wno-error=deprecated-declarations \
    -specs=../ewl_c++.specs  -fdiagnostics-show-option \
    -Wno-missing-field-initializers \
    -Wno-unused-function \
    -Wno-long-long \
    -isystem$(MQX_lib)/bsp/Generated_Code \
    -isystem$(MQX_lib)/bsp \
    -isystem$(MQX_lib)/psp \
    -isystem$(MQX_lib) \
    -isystem$(MQX_lib)/shell \
    -isystem$(MQX_lib)/mfs \
    -isystem$(MQX_lib)/rtcs \
    -isystem$(MQX_lib)/usb \
    -isystem$(CLARINOX_dir) \
    -isystem$(CLARINOX_dir)/Source \
    -isystem$(MQX_lib)/EWL/ARM_GCC_Support/ewl/EWL_C/include \
    -isystem$(MQX_lib)/EWL/ARM_GCC_Support/ewl/EWL_C++/include \
    -isystem$(MQX_lib)/EWL/ARM_GCC_Support/ewl/EWL_Runtime/include \
    $(INCLUDES) \
    $(BUILD_DEFINES) \
    -ffunction-sections -fdata-sections -fconstexpr-depth=4096 -mlong-calls -fno-exceptions \
     DHAVE_MQX\
    -D__VFPV4__=1 -D_DEBUG=1 -c -fmessage-length=0 -D__CC_ARM

ARFLAGS = rc


LINK_FLAGS = \
-mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 \
-g2 -gdwarf-2 -gstrict-dwarf -mlong-calls -fno-exceptions   \
-Wl,-T../intflash_sramdata.ld \
-Xlinker --gc-sections \
    -L$(MQX_lib)/EWL/ARM_GCC_Support/ewl/lib/armv7e-m/fpu
    -L$(MQX_lib)/EWL/ARM_GCC_Support/ewl/lib/armv7e-m
    -L$(MQX_lib)/bsp/Generated_Code \
    -L$(MQX_lib)/bsp \
    -L$(MQX_lib)/psp \
    -L$(MQX_lib)/shell \
    -L$(MQX_lib)/mfs \
    -L$(MQX_lib)/rtcs \
    -L$(MQX_lib)/usb \  

Since I am trying to use the gnu standard library, I added GCC_541=/opt/gcc-arm-none-eabi-5_4-2016q2/lib/gcc/arm-none-eabi/5.4.1 at the beginning of the makefile and replace the EWL includes in the CPP_FLAGS block

-isystem$(MQX_lib)/EWL/ARM_GCC_Support/ewl/EWL_C/include \
-isystem$(MQX_lib)/EWL/ARM_GCC_Support/ewl/EWL_C++/include \
-isystem$(MQX_lib)/EWL/ARM_GCC_Support/ewl/EWL_Runtime/include \

by

-isystem(GCC_541)/include \
-isystem(GCC_541)/include-fixed \

In the LINK_FLAGS block, I replaced the

-L$(MQX_lib)/EWL/ARM_GCC_Support/ewl/lib/armv7e-m/fpu
-L$(MQX_lib)/EWL/ARM_GCC_Support/ewl/lib/armv7e-m

by

-L$(GCC_541)/armv7e-m/fpu \
-L$(GCC_541)/armv7e-m \

After rebuilding the project I got a compile error

Compiling [../../source/TestApps/SomeSrcFile.cpp to obj/SomeSrcFile.obj]
/bin/sh: 1: Syntax error: "(" unexpected
../common.mk:1804: recipe for target 'obj/SomeSrcFile.obj' failed
make[1]: *** [obj/SomeSrcFile.obj] Error 2

I am thinking I might miss something, any suggestions? Thanks

Upvotes: 0

Views: 128

Answers (0)

Related Questions