GCC-ARM-NONE-EABI Bypass custom compiler check?

Hi,

I'm trying move my STM32 project from Gnu Arm Eclipse to CLION 2016.3 on OSX 10.12.2.

I Followed Ilya's blogpost on embedded development (https://blog.jetbrains.com/clion/2016/06/clion-for-embedded-development/) but I'm getting stuck in the custom-compiler-test program:


/usr/local/Cellar/gcc-arm-none-eabi/20160928/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o):
In function `exit':

exit.c:(.text.exit+0x2c): undefined reference to `_exit'

collect2: error: ld returned 1 exit status

 

The linker is throwing undefined references because it doesn't get passed the right linker flags (I've had these errors on eclipse too), although they are present in my toolchain file ( it's only slightly different from Ilya's version):

SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler
set(CMAKE_C_COMPILER /usr/local/Cellar/gcc-arm-none-eabi/20160928/bin/arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER /usr/local/Cellar/gcc-arm-none-eabi/20160928/bin/arm-none-eabi-g++)

SET(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/STM32F429IETx_FLASH.ld)
#SET(COMMON_FLAGS "-mcpu=cortex-m4 -mthumb -mthumb-interwork -mfloat-abi=soft -ffunction-sections -fdata-sections -g -fno-common -fmessage-length=0")
SET(COMMON_FLAGS "-mcpu=cortex-m4 -mthumb -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -g -fno-common -fmessage-length=0")
SET(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=c++11")
SET(CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu99")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl, -Xlinker --gc-sections --specs=nano.specs --specs=nosys.specs -T ${LINKER_SCRIPT}")
SET(CMAKE_C_COMPILER_FORCED)
SET(CMAKE_CXX_COMPILER_FORCED)

So, is there either some way of getting these flags passed in the compiler test, or is there a way to skip the test altogether?

Line 15 of CMakeTestCCompiler.cmake mentions

if(CMAKE_C_COMPILER_FORCED)
# The compiler configuration was forced by the user.
# Assume the user has configured all compiler information.
set(CMAKE_C_COMPILER_WORKS TRUE)
return()
endif()


But I cant seem to set CMAKE_C_COMPILER_FORCED, Probably because I'm too much of a CMake noob.

 

Any help is greatly appreciated!

 

Cheers,

Tim

1
Avatar
Permanently deleted user

First line of your `toolchain.cmake` should be

    include(CMakeForceCompiler)

0

请先登录再写评论。