surenyi
3 years ago
4 changed files with 122 additions and 0 deletions
@ -1,6 +1,7 @@ |
|||
.settings |
|||
Release |
|||
Debug |
|||
build |
|||
*.out |
|||
*.map |
|||
*.bin |
|||
|
@ -0,0 +1,49 @@ |
|||
cmake_minimum_required(VERSION 3.13) |
|||
|
|||
if (NOT DEFINED CMAKE_BUILD_TYPE) |
|||
set(CMAKE_BUILD_TYPE "Release") |
|||
endif() |
|||
|
|||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/lib/cmake) |
|||
|
|||
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE) |
|||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/lib/cmake/c6400-toolchain.cmake) |
|||
endif() |
|||
|
|||
set(tgt_name "c6416_template") |
|||
|
|||
project(${tgt_name} C ASM) |
|||
|
|||
set(CMAKE_EXECUTABLE_SUFFIX .out) |
|||
set(CMAKE_C_STANDARD 11) |
|||
|
|||
add_executable(${tgt_name}) |
|||
|
|||
target_include_directories(${tgt_name} PRIVATE |
|||
${CMAKE_CURRENT_LIST_DIR}/include |
|||
${CMAKE_CURRENT_LIST_DIR}/include/csl |
|||
${CMAKE_CURRENT_LIST_DIR}/include/imglib |
|||
${CMAKE_CURRENT_LIST_DIR}/include/dsplib) |
|||
|
|||
|
|||
target_link_directories(${tgt_name} PRIVATE |
|||
${CMAKE_CURRENT_LIST_DIR}/lib) |
|||
|
|||
target_link_libraries(${tgt_name} PRIVATE |
|||
c6416_sdk.lib |
|||
platform_dsk.lib) |
|||
|
|||
target_link_options(${tgt_name} PRIVATE |
|||
${CMAKE_CURRENT_LIST_DIR}/C6416.cmd) |
|||
|
|||
set(tgt_srcs |
|||
main.c) |
|||
|
|||
target_sources(${tgt_name} PRIVATE ${tgt_srcs}) |
|||
|
|||
add_custom_command(TARGET ${tgt_name} POST_BUILD |
|||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${tgt_name}> ${CMAKE_CURRENT_LIST_DIR}/bin |
|||
COMMAND ${C6X_HEX6X} hex2bin.hexcmd $<TARGET_FILE:${tgt_name}> |
|||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin |
|||
COMMENT "convert coff to binary") |
|||
|
@ -0,0 +1,49 @@ |
|||
include(find_compiler) |
|||
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) |
|||
c6x_find_compiler(C6X_HEX6X hex6x.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() |
|||
|
|||
# Get the C6X_C_DIR |
|||
get_filename_component(CL6X_DIR "${C6X_COMPILER_CC}" DIRECTORY) |
|||
string(REPLACE "bin" "include" C6X_C_DIR "${CL6X_DIR}") |
|||
string(REPLACE "bin" "lib" C6X_CLIB_DIR "${CL6X_DIR}") |
|||
|
|||
set(C6X_C_DIR ${C6X_C_DIR} CACHE PATH "Path to Compiler include path" FORCE) |
|||
|
|||
set(ENV{C6X_C_DIR} "${C6X_C_DIR}") |
|||
|
|||
# on DSP flags |
|||
set(C6X_COMMON_FLAGS "--define=CHIP_6416 --define=c6416 --abi=${C64X_ABI} --include_path=${C6X_C_DIR} --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 --search_path=${C6X_CLIB_DIR}") |
|||
endforeach() |
|||
|
@ -0,0 +1,23 @@ |
|||
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() |
|||
|
Loading…
Reference in new issue