1# SPDX-License-Identifier: Apache-2.0
2
3set(CROSS_COMPILE_TARGET_arm        arm-zephyr-eabi)
4set(CROSS_COMPILE_TARGET_arm64   aarch64-zephyr-elf)
5set(CROSS_COMPILE_TARGET_nios2     nios2-zephyr-elf)
6set(CROSS_COMPILE_TARGET_riscv   riscv64-zephyr-elf)
7set(CROSS_COMPILE_TARGET_mips     mipsel-zephyr-elf)
8set(CROSS_COMPILE_TARGET_xtensa   xtensa-zephyr-elf)
9set(CROSS_COMPILE_TARGET_arc         arc-zephyr-elf)
10set(CROSS_COMPILE_TARGET_x86      x86_64-zephyr-elf)
11set(CROSS_COMPILE_TARGET_sparc     sparc-zephyr-elf)
12
13set(CROSS_COMPILE_TARGET ${CROSS_COMPILE_TARGET_${ARCH}})
14set(SYSROOT_TARGET       ${CROSS_COMPILE_TARGET})
15
16if("${ARCH}" STREQUAL "xtensa")
17  set(SYSROOT_DIR ${TOOLCHAIN_HOME}/xtensa/${SOC_NAME}/${SYSROOT_TARGET})
18  set(CROSS_COMPILE ${TOOLCHAIN_HOME}/xtensa/${SOC_NAME}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-)
19else()
20  set(SYSROOT_DIR   ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}/${SYSROOT_TARGET})
21  set(CROSS_COMPILE ${TOOLCHAIN_HOME}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-)
22endif()
23
24if("${ARCH}" STREQUAL "x86")
25  if(CONFIG_X86_64)
26    list(APPEND TOOLCHAIN_C_FLAGS -m64)
27    list(APPEND TOOLCHAIN_LD_FLAGS -m64)
28  else()
29    list(APPEND TOOLCHAIN_C_FLAGS -m32)
30    list(APPEND TOOLCHAIN_LD_FLAGS -m32)
31  endif()
32endif()
33