This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using ARM toolchain in CMake

Hi,

I use CLion to write my code, and uVision to compile and flash the device. I want to integrate the compiling and flashing process to CLion (CMake).

I integrated ARMclang successfully in CMake. 

How can I link and create  the binary .hex with fromELF.exe? Does anyone have already set up a full toolchain to replace uVision?

Parents
  • Hi ,

    unfortunately, I forfeited my vision to compile in a CMake environment using the Keil Toolchain. 

    Reason: 

    - no support from Keil side (no sample project providing a CMake File that compiles with ARMClang)

    - limited time I wanted to investigate in this topic. 

    My compiling worked, but fixxing the linking was the start of the end.

    My results:

    You need to have a Toolchain.cmake file which you embedded in your CMake "-DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake"

    *Toolchain.cmake*
    SET(CMAKE_SYSTEM_NAME Generic)
    SET(CMAKE_SYSTEM_PROCESSOR cortex-m4) # The name of the cpu 

    #Compiler Setup
    SET(ARMCLANG_PATH "${KEIL_PATH}/ARM/ARMCLANG")

    SET(CMAKE_C_COMPILER "${ARMCLANG_PATH}/bin/armclang.exe")
    SET(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER})

    #CompilerSettings
    SET(CXX_COMPILER_OPTIONS "<copyhere all options from Keil uVision5 -> options for target -> C/c++ -> compiler string control") 

    SET(C_COMPILER_OPTIONS "-std=gnu99 ${CXX_COMPILER_OPTIONS}")


    SET(CMAKE_C_FLAGS ${C_COMPILER_OPTIONS})

    SET(CMAKE_CXX_FLAGS ${CXX_COMPILER_OPTIONS})
    SET(CMAKE_LINKER "${ARMCLANG_PATH}/bin/armlink.exe")
    SET(FROMELF "${ARMCLANG_PATH}/bin/fromelf.exe")

    If you have any success with linking, please share it

Reply
  • Hi ,

    unfortunately, I forfeited my vision to compile in a CMake environment using the Keil Toolchain. 

    Reason: 

    - no support from Keil side (no sample project providing a CMake File that compiles with ARMClang)

    - limited time I wanted to investigate in this topic. 

    My compiling worked, but fixxing the linking was the start of the end.

    My results:

    You need to have a Toolchain.cmake file which you embedded in your CMake "-DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake"

    *Toolchain.cmake*
    SET(CMAKE_SYSTEM_NAME Generic)
    SET(CMAKE_SYSTEM_PROCESSOR cortex-m4) # The name of the cpu 

    #Compiler Setup
    SET(ARMCLANG_PATH "${KEIL_PATH}/ARM/ARMCLANG")

    SET(CMAKE_C_COMPILER "${ARMCLANG_PATH}/bin/armclang.exe")
    SET(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER})

    #CompilerSettings
    SET(CXX_COMPILER_OPTIONS "<copyhere all options from Keil uVision5 -> options for target -> C/c++ -> compiler string control") 

    SET(C_COMPILER_OPTIONS "-std=gnu99 ${CXX_COMPILER_OPTIONS}")


    SET(CMAKE_C_FLAGS ${C_COMPILER_OPTIONS})

    SET(CMAKE_CXX_FLAGS ${CXX_COMPILER_OPTIONS})
    SET(CMAKE_LINKER "${ARMCLANG_PATH}/bin/armlink.exe")
    SET(FROMELF "${ARMCLANG_PATH}/bin/fromelf.exe")

    If you have any success with linking, please share it

Children
No data