CLion: Can not Use non-EABI compiler

I try evaluate Clion for Embedded  ARM CPU.  I test with clion  2016.3

I read : 

https://dev.widemeadows.de/2015/02/12/forcing-arm-eabi-gcc-onto-clion-eap-on-windows/

https://blog.jetbrains.com/clion/2016/06/clion-for-embedded-development/

i must use minGW or cygwin.  i choose minGW-64 5.4

after it i override mingw & use arm-none-EABI compiler in then

In CLion’s Build, Execution, Deployment > CMake settings we then set the CMake Generation options with

 
 
-DTOOLCHAIN_DIR:PATH=c:/path/to/arm-non-eabi/
-DCMAKE_TOOLCHAIN_FILE=toolchain.cmake
 
 seems make not use my non-eabi compiler & use mingw compiler !
Cannot get compiler information for configuration Debug: Compiler exited with error code 1: C:\mingw64-5.4\bin\gcc.exe

 

in toolchain.cmake :

INCLUDE(CMakeForceCompiler)

SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_SYSTEM_VERSION 1)

include(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR cortex-m3)

message("TOOLCHAIN_DIR: ${TOOLCHAIN_DIR}")

find_program(ARM_CC arm-none-eabi-gcc
        ${TOOLCHAIN_DIR}/bin
        )
find_program(ARM_CXX arm-none-eabi-g++
        ${TOOLCHAIN_DIR}/bin
        )
find_program(ARM_OBJCOPY arm-none-eabi-objcopy
        ${TOOLCHAIN_DIR}/bin
        )
find_program(ARM_SIZE_TOOL arm-none-eabi-size
        ${TOOLCHAIN_DIR}/bin)

CMAKE_FORCE_C_COMPILER(${ARM_CC} GNU)
CMAKE_FORCE_CXX_COMPILER(${ARM_CXX} GNU)

set(CMAKE_C_FLAGS
        "${CMAKE_C_FLAGS}"
        "-fno-common -ffunction-sections -fdata-sections"
        )

if (CMAKE_SYSTEM_PROCESSOR STREQUAL "cortex-m3")

    set(CMAKE_C_FLAGS
            "${CMAKE_C_FLAGS}"
            "-mcpu=cortex-m3 -mthumb"
            )

else ()
    message(WARNING
            "Processor not recognised in toolchain file, "
            "compiler flags not configured."
            )
endif ()

# fix long strings (CMake appends semicolons)
string(REGEX REPLACE ";" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "")

set(BUILD_SHARED_LIBS OFF)

 

IN cmakelist.txt

cmake_minimum_required(VERSION 3.6)
project(SC1)

add_definitions(-Dtoolchain)

set(CMAKE_CXX_STANDARD 11)


file(GLOB_RECURSE USER_SRC
        ${PROJECT_SOURCE_DIR}/*.cpp)

file(GLOB_RECURSE FIRMWARE_SRC
        "firmware/*.c")

set(LINKER_SCRIPT mylinker.ld)

include_directories(firmware/CMSIS/startup_gcc)


add_executable(${PROJECT_NAME}.elf ${USER_SOURCES} ${FIRMWARE_SRC} ${LINKER_SCRIPT})

target_link_libraries(${PROJECT_NAME}.elf FIRMWARE_SRC)

 

 

 

 

 

 

 

 

0
1 comment

Are you able to run the compiler successfully from the command line (outside of CLion, without CMake)?

0

Please sign in to leave a comment.