|
|
|
function(c6x_find_compiler compiler_path compiler_exe)
|
|
|
|
# Search user provided path first.
|
|
|
|
find_program(
|
|
|
|
${compiler_path} ${compiler_exe}
|
|
|
|
PATHS "d:/ti/ccsv5/tools/compiler/c6000_7.4.4" "d:/ti/ccsv5/tools/compiler/c6000_7.4.1" "c:/ti/ccsv5/tools/compiler/c6000_7.4.4" "c:/ti/ccsv5/tools/compiler/c6000_7.4.1"
|
|
|
|
PATH_SUFFIXES bin
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
)
|
|
|
|
|
|
|
|
# If not then search system paths.
|
|
|
|
if ("${${compiler_path}}" STREQUAL "${compiler_path}-NOTFOUND")
|
|
|
|
if (DEFINED ENV{C6X_TOOLCHAIN_PATH})
|
|
|
|
message(WARNING "C6X_TOOLCHAIN_PATH specified ($ENV{C6X_TOOLCHAIN_PATH}), but ${compiler_exe} not found there")
|
|
|
|
endif()
|
|
|
|
find_program(${compiler_path} ${compiler_exe})
|
|
|
|
endif ()
|
|
|
|
if ("${${compiler_path}}" STREQUAL "${compiler_path}-NOTFOUND")
|
|
|
|
set(C6X_TOOLCHAIN_PATH "" CACHE PATH "Path to search for compiler.")
|
|
|
|
message(FATAL_ERROR "Compiler '${compiler_exe}' not found, you can specify search path with\
|
|
|
|
\"C6X_TOOLCHAIN_PATH\".")
|
|
|
|
endif ()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
|
|
|
|
|
|
|
set(CMAKE_SYSTEM_NAME Generic)
|
|
|
|
set(CMAKE_SYSTEM_PROCESSOR c6416)
|
|
|
|
|
|
|
|
c6x_find_compiler(C6X_COMPILER_CC cl6x.exe)
|
|
|
|
|
|
|
|
# Specify the cross compiler.
|
|
|
|
set(CMAKE_C_COMPILER ${C6X_COMPILER_CC} CACHE FILEPATH "C compiler")
|
|
|
|
set(CMAKE_CXX_COMPILER ${C6X_COMPILER_CC} CACHE FILEPATH "C++ compiler")
|
|
|
|
|
|
|
|
# todo should we be including CMakeASMInformation anyway - i guess that is host side
|
|
|
|
set(CMAKE_ASM_COMPILER ${C6X_COMPILER_CC} CACHE FILEPATH "ASM compiler")
|
|
|
|
|
|
|
|
# Look for includes and libraries only in the target system prefix.
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
|
|
|
|
|
|
if (NOT DEFINED C64X_ABI)
|
|
|
|
set(C64X_ABI "coffabi")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# on DSP flags
|
|
|
|
set(C6X_COMMON_FLAGS "--define=CHIP_6416 --define=c6416 --abi=${C64X_ABI} --relaxed_ansi -mv6400")
|
|
|
|
foreach(LANG IN ITEMS C CXX ASM)
|
|
|
|
set(CMAKE_${LANG}_FLAGS_INIT "${C6X_COMMON_FLAGS}")
|
|
|
|
|
|
|
|
if (CSL_DEOPTIMIZED_DEBUG)
|
|
|
|
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O2")
|
|
|
|
else()
|
|
|
|
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-g")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(CMAKE_${LANG}_LINK_FLAGS "--rom_model")
|
|
|
|
endforeach()
|
|
|
|
|