generic.cmake 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # SPDX-License-Identifier: Apache-2.0
  2. set_ifndef(XTENSA_TOOLCHAIN_PATH "$ENV{XTENSA_TOOLCHAIN_PATH}")
  3. set( XTENSA_TOOLCHAIN_PATH ${XTENSA_TOOLCHAIN_PATH} CACHE PATH "xtensa tools install directory")
  4. assert( XTENSA_TOOLCHAIN_PATH "XTENSA_TOOLCHAIN_PATH is not set")
  5. if(NOT EXISTS ${XTENSA_TOOLCHAIN_PATH})
  6. message(FATAL_ERROR "Nothing found at XTENSA_TOOLCHAIN_PATH: '${XTENSA_TOOLCHAIN_PATH}'")
  7. endif()
  8. set(TOOLCHAIN_HOME ${XTENSA_TOOLCHAIN_PATH}/$ENV{TOOLCHAIN_VER}/XtensaTools)
  9. set(COMPILER xcc)
  10. set(LINKER ld)
  11. set(BINTOOLS gnu)
  12. set(CROSS_COMPILE_TARGET xt)
  13. set(SYSROOT_TARGET xtensa-elf)
  14. set(CROSS_COMPILE ${TOOLCHAIN_HOME}/bin/${CROSS_COMPILE_TARGET}-)
  15. set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET})
  16. # xt-xcc does not support -Og, so make it -O0
  17. set(OPTIMIZE_FOR_DEBUG_FLAG "-O0")
  18. if($ENV{XCC_USE_CLANG})
  19. set(CC clang)
  20. set(C++ clang++)
  21. else()
  22. set(CC xcc)
  23. set(C++ xc++)
  24. list(APPEND TOOLCHAIN_C_FLAGS
  25. -imacros${ZEPHYR_BASE}/include/toolchain/xcc_missing_defs.h
  26. )
  27. endif()
  28. set(NOSYSDEF_CFLAG "")
  29. list(APPEND TOOLCHAIN_C_FLAGS -fms-extensions)
  30. set(TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib")
  31. message(STATUS "Found toolchain: xcc (${XTENSA_TOOLCHAIN_PATH})")