is not a full path to an existing compiler tool

Hi I am new to Cmake.
I have installed Cmake tool and downloaded gcc-arm-none-eabi.

Below settings I have done in my cmake file
set(ARM_NONE_EABI_TOOLCHAIN_PATH “C:/Users/XXXXX/binaries/gcc-arm-none-eabi/bin”)

Also I have set the CC and CXX variables in the environment path as below
C:\Users\XXXXX\binaries\gcc-arm-none-eabi\bin\arm-none-eabi-gcc
C:\Users\XXXXX\binaries\gcc-arm-none-eabi\bin\arm-none-eabi-g++

When I run the Cmake I am getting below error
– The C compiler identification is unknown
– The CXX compiler identification is unknown

C:/Users/XXXXX/binaries/gcc-arm-none-eabi/bin/bin/arm-none-eabi-gcc

is not a full path to an existing compiler tool.

Kindly advice

C:/Users/XXXXX/binaries/gcc-arm-none-eabi/bin/bin/arm-none-eabi-gcc contains bin/bin, which doesn’t seem correct. I guess you should set ARM_NONE_EABI_TOOLCHAIN_PATH to "C:/Users/XXXXX/binaries/gcc-arm-none-eabi" (i.e. without the trailing /bin).

I hope this helps.

You don’t show your tool-chain file to see what you are doing with ARM_NONE_EABI_TOOLCHAIN_PATH . Setting CC and CCX in the environment is fine but then that is what it should use for CMAKE_C_COMPILER and CMAKE_CXX_COMPILER.

Also the output log and error log will have details on how it tried to invoke the compiler on the command line.

Hi,
Sorry for my delayed response . Now I have installed “GNU Tools Arm Embedded” and set the below environment variables
ARM_NONE_EABI_TOOLCHAIN_PATH = C:\Program Files (x86)\GNU Tools Arm Embedded\9 2019-q4-major

CC = C:\Program Files (x86)\GNU Tools Arm Embedded\9 2019-q4-major\bin\arm-none-eabi-gcc.
I am using MinGW for generating the makfiles.


CmakeError.log
Compiling the C compiler identification source file “CMakeCCompilerId.c” failed.
Compiler: C:/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin/arm-none-eabi-gcc.exe
Build flags:
Id flags:

The output was:
1
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/lib\libc.a(lib_a-exit.o): in function exit': exit.c:(.text.exit+0x2c): undefined reference to _exit’
collect2.exe: error: ld returned 1 exit status

Determining if the C compiler works failed with the following output:
Change Dir: D:/SDK/15.3/nRF5_SDK_15.3/examples/ble_peripheral/ble_app_blinky/cmake-build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/MinGW/bin/mingw32-make.exe cmTC_f7474/fast
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_f7474.dir\build.make CMakeFiles/cmTC_f7474.dir/build

mingw32-make.exe[1]: Entering directory ‘D:/SDK/15.3/nRF5_SDK_15.3/examples/ble_peripheral/ble_app_blinky/cmake-build/CMakeFiles/CMakeTmp’

Building C object CMakeFiles/cmTC_f7474.dir/testCCompiler.c.obj

C:\PROGRA~2\GNUTOO~1\92019-~1\bin\AR19DD~1.EXE -o CMakeFiles\cmTC_f7474.dir\testCCompiler.c.obj -c D:\SDK\15.3\nRF5_SDK_15.3\examples\ble_peripheral\ble_app_blinky\cmake-build\CMakeFiles\CMakeTmp\testCCompiler.c

Linking C executable cmTC_f7474.exe

“C:\Program Files\CMake\bin\cmake.exe” -E cmake_link_script CMakeFiles\cmTC_f7474.dir\link.txt --verbose=1

“C:\Program Files\CMake\bin\cmake.exe” -E remove -f CMakeFiles\cmTC_f7474.dir/objects.a
CMAKE_AR-NOTFOUND cr CMakeFiles\cmTC_f7474.dir/objects.a @CMakeFiles\cmTC_f7474.dir\objects1.rsp
Error running link command: The system cannot find the file specified
CMakeFiles\cmTC_f7474.dir\build.make:86: recipe for target ‘cmTC_f7474.exe’ failed

mingw32-make.exe[1]: *** [cmTC_f7474.exe] Error 2

mingw32-make.exe[1]: Leaving directory ‘D:/SDK/15.3/nRF5_SDK_15.3/examples/ble_peripheral/ble_app_blinky/cmake-build/CMakeFiles/CMakeTmp’

Makefile:120: recipe for target ‘cmTC_f7474/fast’ failed

mingw32-make.exe: *** [cmTC_f7474/fast] Error 2

CmakeList.txt
cmake_minimum_required (VERSION 3.14)
project(ble_app_blinky_pca10040_s132 C ASM)
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS “”)
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS “”)
set(PROJECT_ROOT_FOLDER “D:/SDK/15.3/nRF5_SDK_15.3/examples/ble_peripheral/ble_app_blinky/pca10040/s132/armgcc”)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_definitions(
-DBOARD_PCA10040
-DCONFIG_GPIO_AS_PINRESET
-DFLOAT_ABI_HARD
-DINITIALIZE_USER_SECTIONS
-DNO_VTOR_CONFIG
-DNRF52
-DNRF52832_XXAA
-DNRF52_PAN_74
-DNRF_SD_BLE_API_VERSION=6
-DS132
-DSOFTDEVICE_PRESENT
-DSWI_DISABLE0
)
include_directories(
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_advertising
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_dtm
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_racp
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_ancs_c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_ans_c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_bas
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_bas_c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_cscs
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_cts_c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_dfu
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_dis
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_gls
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_hids
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_hrs
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_hrs_c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_hts
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_ias
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_ias_c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_lbs
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_lbs_c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_lls
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_nus
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_nus_c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_rscs
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_rscs_c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_tps
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/common
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/nrf_ble_gatt
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/nrf_ble_qwr
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/peer_manager
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/boards
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/atomic
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/atomic_fifo
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/atomic_flags
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/balloc
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/bootloader/ble_dfu
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/button
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/cli
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/crc16
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/crc32
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/crypto
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/csense
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/csense_drv
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/delay
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/ecc
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/experimental_section_vars
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/experimental_task_manager
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/fds
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/fstorage
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/gfx
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/gpiote
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/hardfault
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/hci
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/led_softblink
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/log
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/log/src
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/low_power_pwm
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/mem_manager
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/memobj
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/mpu
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/mutex
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/pwm
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/pwr_mgmt
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/queue
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/ringbuf
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/scheduler
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/sdcard
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/slip
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/sortlist
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/spi_mngr
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/stack_guard
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/strerror
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/svc
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/timer
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/twi_mngr
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/twi_sensor
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/usbd
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/usbd/class/audio
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/usbd/class/cdc
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/usbd/class/cdc/acm
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/usbd/class/hid
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/usbd/class/hid/generic
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/usbd/class/hid/kbd
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/usbd/class/hid/mouse
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/usbd/class/msc
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/util
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/conn_hand_parser
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/conn_hand_parser/ac_rec_parser
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/conn_hand_parser/ble_oob_advdata_parser
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/conn_hand_parser/le_oob_rec_parser
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/connection_handover/ac_rec
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/connection_handover/ble_oob_advdata
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/connection_handover/ble_pair_lib
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/connection_handover/ble_pair_msg
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/connection_handover/common
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/connection_handover/ep_oob_rec
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/connection_handover/hs_rec
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/connection_handover/le_oob_rec
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/generic/message
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/generic/record
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/launchapp
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/parser/message
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/parser/record
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/text
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/ndef/uri
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/t2t_lib
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/t2t_parser
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/t4t_lib
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/t4t_parser/apdu
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/t4t_parser/cc_file
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/t4t_parser/hl_detection_procedure
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/nfc/t4t_parser/tlv
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/softdevice/common
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/softdevice/s132/headers
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/softdevice/s132/headers/nrf52
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/toolchain/cmsis/include
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/external/fprintf
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/external/segger_rtt
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/external/utf_converter
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/integration/nrfx
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/integration/nrfx/legacy
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx/drivers/include
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx/hal
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx/mdk
${PROJECT_ROOT_FOLDER}/…/config
)
set(SOURCE_FILES
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx/mdk/gcc_startup_nrf52.S
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/log/src/nrf_log_backend_rtt.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/log/src/nrf_log_backend_serial.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/log/src/nrf_log_backend_uart.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/log/src/nrf_log_default_backends.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/log/src/nrf_log_frontend.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/log/src/nrf_log_str_formatter.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/button/app_button.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/util/app_error.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/util/app_error_handler_gcc.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/util/app_error_weak.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/scheduler/app_scheduler.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/timer/app_timer.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/util/app_util_platform.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/hardfault/hardfault_implementation.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/util/nrf_assert.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/atomic_fifo/nrf_atfifo.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/atomic_flags/nrf_atflags.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/atomic/nrf_atomic.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/balloc/nrf_balloc.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/external/fprintf/nrf_fprintf.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/external/fprintf/nrf_fprintf_format.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/memobj/nrf_memobj.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/ringbuf/nrf_ringbuf.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/experimental_section_vars/nrf_section_iter.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/libraries/strerror/nrf_strerror.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx/mdk/system_nrf52.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/boards/boards.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/integration/nrfx/legacy/nrf_drv_clock.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/integration/nrfx/legacy/nrf_drv_uart.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx/soc/nrfx_atomic.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx/drivers/src/nrfx_clock.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx/drivers/src/nrfx_gpiote.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx/drivers/src/prs/nrfx_prs.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx/drivers/src/nrfx_uart.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx/drivers/src/nrfx_uarte.c
${PROJECT_ROOT_FOLDER}/…/…/…/main.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/external/segger_rtt/SEGGER_RTT.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/external/segger_rtt/SEGGER_RTT_Syscalls_GCC.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/external/segger_rtt/SEGGER_RTT_printf.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/common/ble_advdata.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_advertising/ble_advertising.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/common/ble_conn_params.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/common/ble_conn_state.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/common/ble_srv_common.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/nrf_ble_gatt/nrf_ble_gatt.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/nrf_ble_qwr/nrf_ble_qwr.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/ble/ble_services/ble_lbs/ble_lbs.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/external/utf_converter/utf.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/softdevice/common/nrf_sdh.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/softdevice/common/nrf_sdh_ble.c
${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/components/softdevice/common/nrf_sdh_soc.c
)
set(CMAKE_C_FLAGS " -O3 -g3 -mcpu=cortex-m4 -mthumb -mabi=aapcs -Wall -Werror -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin -fshort-enums")

set(LINKER_SCRIPT ${PROJECT_ROOT_FOLDER}/ble_app_blinky_gcc_nrf52.ld)
set(CMAKE_EXE_LINKER_FLAGS " -O3 -g3 -mthumb -mabi=aapcs -L${PROJECT_ROOT_FOLDER}/…/…/…/…/…/…/modules/nrfx/mdk -T…/ble_app_blinky_gcc_nrf52.ld -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,–gc-sections --specs=nano.specs")

set(CMAKE_ASM_FLAGS " -g3 -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=hard -mfpu=fpv4-sp-d16")

add_executable(${PROJECT_NAME}.elf ${SOURCE_FILES})

set(HEX_FILE ${PROJECT_NAME}.hex)
set(BIN_FILE ${PROJECT_NAME}.bin)

add_custom_command(TARGET ${PROJECT_NAME}.elf POST_BUILD
COMMAND ${OBJCOPY} -Oihex $<TARGET_FILE:${PROJECT_NAME}.elf> ${HEX_FILE}
COMMAND ${OBJCOPY} -Obinary $<TARGET_FILE:${PROJECT_NAME}.elf> ${BIN_FILE}
COMMENT “Building ${HEX_FILE} \nBuilding ${BIN_FILE}”
)
Looking at the error I am clueless… Pls advice me

You are not properly setup to use that compiler in the way you have set the compiler flags. Refer to https://gitlab.kitware.com/cmake/cmake/issues/18730. Basically with the default settings this compiler can’t build full executable projects because it doesn’t provide a fully implemented c library so the linking phase fails. Try setting CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY either in the toolchain file or before the project() command. That should make this step build a static library and not an executable.

1 Like

Hi Thank you for your mail.
Could you please elaborate “You are not properly setup to use that compiler”. Please share reference link to understand better.
I have modified the CmakeLists.txt from the link
SET(CMAKE_SYSTEM_NAME Generic)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_SYSTEM_PROCESSOR arm)
SET(CMAKE_CROSSCOMPILING 1)
set(triple arm-none-eabi)
SET(CMAKE_C_COMPILER_TARGET ${triple})
SET(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

project(ble_app_blinky_pca10040_s132 C ASM)

With this changes I could see linker issue seems to be resolved
D:\SDK\15.3\nRF5_SDK_15.3\examples\ble_peripheral\ble_app_blinky>cmake -B"cmake-build" -G “MinGW Makefiles” .
– The C compiler identification is GNU 9.2.1
– The ASM compiler identification is GNU
– Found assembler: C:/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin/arm-none-eabi-gcc.exe
– Check for working C compiler: C:/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin/arm-none-eabi-gcc.exe
– Check for working C compiler: C:/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin/arm-none-eabi-gcc.exe – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Configuring done
– Generating done
– Build files have been written to: D:/SDK/15.3/nRF5_SDK_15.3/examples/ble_peripheral/ble_app_blinky/cmake-build

But in error log I could still see
Compiling the C compiler identification source file “CMakeCCompilerId.c” failed.
Compiler: C:/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin/arm-none-eabi-gcc.exe
Build flags:
Id flags:

The output was:
1
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/lib\libc.a(lib_a-exit.o): in function exit': exit.c:(.text.exit+0x2c): undefined reference to _exit’
collect2.exe: error: ld returned 1 exit status

From my understanding this error is nothing to do with my project.
Using Makefile generated I can go ahead and build the executable.
Please share your advice.

All the relevant links are in issue #18730. I thought I already clarified my statement by also saying:

The CMake issue mentions several options you could take regarding on how to build executable programs, assuming you are using this compiler or something similar: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm.

Unless you deleted the error log file it will keep its contents. This may have been the error from before you updated your toolchain file.

BTW, You’ll want to set CMAKE_<LANG>_FLAGS with the proper settings for the kind of ARM chip you are targeting.

Here is another example of how someone chose to resolve their linking issues. Also note in the original question where they mentioned using --cpu Cortex-M3 to set the target CPU type. This is also in the aforementioned links.

1 Like

Thank you…