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) 8if(CONFIG_LTO) 9 find_program(CMAKE_AR ${CROSS_COMPILE}gcc-ar PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 10 find_program(CMAKE_RANLIB ${CROSS_COMPILE}gcc-ranlib PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 11else() 12 find_program(CMAKE_AR ${CROSS_COMPILE}ar PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 13 find_program(CMAKE_RANLIB ${CROSS_COMPILE}ranlib PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 14endif() 15find_program(CMAKE_READELF ${CROSS_COMPILE}readelf PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 16find_program(CMAKE_NM ${CROSS_COMPILE}nm PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 17find_program(CMAKE_STRIP ${CROSS_COMPILE}strip PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 18 19find_program(CMAKE_GDB ${CROSS_COMPILE}gdb-py PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 20 21if(CMAKE_GDB) 22 execute_process( 23 COMMAND ${CMAKE_GDB} --configuration 24 RESULTS_VARIABLE GDB_CFG_ERR 25 OUTPUT_QUIET 26 ERROR_QUIET 27 ) 28endif() 29 30if(NOT CMAKE_GDB OR GDB_CFG_ERR) 31 find_program(CMAKE_GDB_NO_PY ${CROSS_COMPILE}gdb PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 32 33 if(CMAKE_GDB_NO_PY) 34 set(CMAKE_GDB ${CMAKE_GDB_NO_PY} CACHE FILEPATH "Path to a program." FORCE) 35 endif() 36endif() 37 38# Include bin tool properties 39include(${ZEPHYR_BASE}/cmake/bintools/gnu/target_bintools.cmake) 40