surenyi
3 years ago
101 changed files with 99 additions and 0 deletions
@ -0,0 +1,2 @@ |
|||||
|
*.obj |
||||
|
build |
@ -0,0 +1,39 @@ |
|||||
|
cmake_minimum_required(VERSION 3.13) |
||||
|
|
||||
|
# set a default build type if none was specified |
||||
|
set(default_build_type "Release") |
||||
|
|
||||
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) |
||||
|
message(STATUS "Defaulting build type to '${default_build_type}' since not specified.") |
||||
|
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build, options are: 'Debug', 'Release', 'MinSizeRel', 'RelWithDebInfo'." FORCE) |
||||
|
# Set the possible values of build type for cmake-gui |
||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") |
||||
|
endif() |
||||
|
|
||||
|
if (CMAKE_BUILD_TYPE STREQUAL "Default") |
||||
|
error("Default build type is NOT supported") |
||||
|
endif() |
||||
|
|
||||
|
# add cmake to module path |
||||
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) |
||||
|
|
||||
|
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE) |
||||
|
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/cmake/c6400-toolchain.cmake) |
||||
|
endif() |
||||
|
|
||||
|
message("${CMAKE_TOOLCHAIN_FILE}") |
||||
|
|
||||
|
project(csl_sdk C ASM) |
||||
|
|
||||
|
set(CMAKE_EXECUTABLE_SUFFIX .elf) |
||||
|
set(CMAKE_STATIC_LIBRARY_SUFFIX .lib) |
||||
|
set(CMAKE_STATIC_LIBRARY_PREFIX "") |
||||
|
|
||||
|
set(CMAKE_C_STANDARD 11) |
||||
|
|
||||
|
file(GLOB csl_sdk_srcs src/*.c) |
||||
|
|
||||
|
add_library(csl6416 STATIC ${csl_sdk_srcs}) |
||||
|
|
||||
|
target_include_directories(csl6416 PUBLIC |
||||
|
${CMAKE_CURRENT_LIST_DIR}/include/csl) |
@ -0,0 +1,58 @@ |
|||||
|
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") |
||||
|
set(CMAKE_C_OUTPUT_EXTENSION .o) |
||||
|
|
||||
|
# 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) |
||||
|
|
||||
|
# on DSP flags |
||||
|
set(C6X_COMMON_FLAGS "--define=CHIP_6416 --define=c6416 --relaxed_ansi") |
||||
|
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 "-O0") |
||||
|
else() |
||||
|
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-Og") |
||||
|
endif() |
||||
|
|
||||
|
set(CMAKE_${LANG}_LINK_FLAGS "--rom_model") |
||||
|
endforeach() |
||||
|
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue