1# SPDX-License-Identifier: Apache-2.0
2
3# Configures binary tools as GNU binutils
4
5find_program(CMAKE_OBJCOPY ${CROSS_COMPILE}objcopy PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
6find_program(CMAKE_OBJDUMP ${CROSS_COMPILE}objdump PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
7find_program(CMAKE_AS      ${CROSS_COMPILE}as      PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
8find_program(CMAKE_AR      ${CROSS_COMPILE}ar      PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
9find_program(CMAKE_RANLIB  ${CROSS_COMPILE}ranlib  PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
10find_program(CMAKE_READELF ${CROSS_COMPILE}readelf PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
11find_program(CMAKE_NM      ${CROSS_COMPILE}nm      PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
12find_program(CMAKE_STRIP   ${CROSS_COMPILE}strip   PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
13
14find_program(CMAKE_GDB     ${CROSS_COMPILE}gdb-py  PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
15
16if(CMAKE_GDB)
17  execute_process(
18    COMMAND ${CMAKE_GDB} --configuration
19    RESULTS_VARIABLE GDB_CFG_ERR
20    OUTPUT_QUIET
21    ERROR_QUIET
22    )
23endif()
24
25if(NOT CMAKE_GDB OR GDB_CFG_ERR)
26  find_program(CMAKE_GDB_NO_PY ${CROSS_COMPILE}gdb PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
27
28  if(CMAKE_GDB_NO_PY)
29    set(CMAKE_GDB ${CMAKE_GDB_NO_PY} CACHE FILEPATH "Path to a program." FORCE)
30  endif()
31endif()
32
33# Include bin tool properties
34include(${ZEPHYR_BASE}/cmake/bintools/gnu/target_bintools.cmake)
35