0%

How to use arm-none-eabi-gcc on CMake

  • To follow this instructions that solve the compiled problem.

  • To create a cmake file named ‘cross_compile.cmake’

    1
    2
    3
    4
    set(CMAKE_SYSTEM_NAME Generic)
    set(CMAKE_SYSTEM_PROCESSOR arm)
    set(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/bin/arm-none-eabi-gcc)
    set(CMAKE_EXE_LINKER_FLAGS "--specs=nosys.specs" CACHE INTERNAL "")
  • Following the command for cross compiling

    1
    2
    3
    $ mkdir build
    $ cd build
    $ cmake -DCMAKE_TOOLCHAIN_FILE=../cross_compile.cmake ..
  • Remember that don’t forget the ‘CMakeLists.txt’.

  • That’s all. Hope it will be worked in your project. I will introduce CMake for next topic.