diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..966c2fe --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.obj +build diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e07a376 --- /dev/null +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/c6400-toolchain.cmake b/cmake/c6400-toolchain.cmake new file mode 100644 index 0000000..ea1c517 --- /dev/null +++ b/cmake/c6400-toolchain.cmake @@ -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() + diff --git a/csl.h b/include/csl/csl.h similarity index 100% rename from csl.h rename to include/csl/csl.h diff --git a/csl_atl.h b/include/csl/csl_atl.h similarity index 100% rename from csl_atl.h rename to include/csl/csl_atl.h diff --git a/csl_atlhal.h b/include/csl/csl_atlhal.h similarity index 100% rename from csl_atlhal.h rename to include/csl/csl_atlhal.h diff --git a/csl_cache.h b/include/csl/csl_cache.h similarity index 100% rename from csl_cache.h rename to include/csl/csl_cache.h diff --git a/csl_cachehal.h b/include/csl/csl_cachehal.h similarity index 100% rename from csl_cachehal.h rename to include/csl/csl_cachehal.h diff --git a/csl_chip.h b/include/csl/csl_chip.h similarity index 100% rename from csl_chip.h rename to include/csl/csl_chip.h diff --git a/csl_chiphal.h b/include/csl/csl_chiphal.h similarity index 100% rename from csl_chiphal.h rename to include/csl/csl_chiphal.h diff --git a/csl_dat.h b/include/csl/csl_dat.h similarity index 100% rename from csl_dat.h rename to include/csl/csl_dat.h diff --git a/csl_dma.h b/include/csl/csl_dma.h similarity index 100% rename from csl_dma.h rename to include/csl/csl_dma.h diff --git a/csl_dmahal.h b/include/csl/csl_dmahal.h similarity index 100% rename from csl_dmahal.h rename to include/csl/csl_dmahal.h diff --git a/csl_edma.h b/include/csl/csl_edma.h similarity index 100% rename from csl_edma.h rename to include/csl/csl_edma.h diff --git a/csl_edmahal.h b/include/csl/csl_edmahal.h similarity index 100% rename from csl_edmahal.h rename to include/csl/csl_edmahal.h diff --git a/csl_emac.h b/include/csl/csl_emac.h similarity index 100% rename from csl_emac.h rename to include/csl/csl_emac.h diff --git a/csl_emachal.h b/include/csl/csl_emachal.h similarity index 100% rename from csl_emachal.h rename to include/csl/csl_emachal.h diff --git a/csl_emif.h b/include/csl/csl_emif.h similarity index 100% rename from csl_emif.h rename to include/csl/csl_emif.h diff --git a/csl_emifa.h b/include/csl/csl_emifa.h similarity index 100% rename from csl_emifa.h rename to include/csl/csl_emifa.h diff --git a/csl_emifahal.h b/include/csl/csl_emifahal.h similarity index 100% rename from csl_emifahal.h rename to include/csl/csl_emifahal.h diff --git a/csl_emifb.h b/include/csl/csl_emifb.h similarity index 100% rename from csl_emifb.h rename to include/csl/csl_emifb.h diff --git a/csl_emifbhal.h b/include/csl/csl_emifbhal.h similarity index 100% rename from csl_emifbhal.h rename to include/csl/csl_emifbhal.h diff --git a/csl_emifhal.h b/include/csl/csl_emifhal.h similarity index 100% rename from csl_emifhal.h rename to include/csl/csl_emifhal.h diff --git a/csl_emu.h b/include/csl/csl_emu.h similarity index 100% rename from csl_emu.h rename to include/csl/csl_emu.h diff --git a/csl_emuhal.h b/include/csl/csl_emuhal.h similarity index 100% rename from csl_emuhal.h rename to include/csl/csl_emuhal.h diff --git a/csl_gpio.h b/include/csl/csl_gpio.h similarity index 100% rename from csl_gpio.h rename to include/csl/csl_gpio.h diff --git a/csl_gpiohal.h b/include/csl/csl_gpiohal.h similarity index 100% rename from csl_gpiohal.h rename to include/csl/csl_gpiohal.h diff --git a/csl_gpioleg.h b/include/csl/csl_gpioleg.h similarity index 100% rename from csl_gpioleg.h rename to include/csl/csl_gpioleg.h diff --git a/csl_hpi.h b/include/csl/csl_hpi.h similarity index 100% rename from csl_hpi.h rename to include/csl/csl_hpi.h diff --git a/csl_hpihal.h b/include/csl/csl_hpihal.h similarity index 100% rename from csl_hpihal.h rename to include/csl/csl_hpihal.h diff --git a/csl_i2c.h b/include/csl/csl_i2c.h similarity index 100% rename from csl_i2c.h rename to include/csl/csl_i2c.h diff --git a/csl_i2chal.h b/include/csl/csl_i2chal.h similarity index 100% rename from csl_i2chal.h rename to include/csl/csl_i2chal.h diff --git a/csl_irq.h b/include/csl/csl_irq.h similarity index 100% rename from csl_irq.h rename to include/csl/csl_irq.h diff --git a/csl_irqhal.h b/include/csl/csl_irqhal.h similarity index 100% rename from csl_irqhal.h rename to include/csl/csl_irqhal.h diff --git a/csl_legacy.h b/include/csl/csl_legacy.h similarity index 100% rename from csl_legacy.h rename to include/csl/csl_legacy.h diff --git a/csl_legacyhal.h b/include/csl/csl_legacyhal.h similarity index 100% rename from csl_legacyhal.h rename to include/csl/csl_legacyhal.h diff --git a/csl_mcasp.h b/include/csl/csl_mcasp.h similarity index 100% rename from csl_mcasp.h rename to include/csl/csl_mcasp.h diff --git a/csl_mcasphal.h b/include/csl/csl_mcasphal.h similarity index 100% rename from csl_mcasphal.h rename to include/csl/csl_mcasphal.h diff --git a/csl_mcbsp.h b/include/csl/csl_mcbsp.h similarity index 100% rename from csl_mcbsp.h rename to include/csl/csl_mcbsp.h diff --git a/csl_mcbsphal.h b/include/csl/csl_mcbsphal.h similarity index 100% rename from csl_mcbsphal.h rename to include/csl/csl_mcbsphal.h diff --git a/csl_mdio.h b/include/csl/csl_mdio.h similarity index 100% rename from csl_mdio.h rename to include/csl/csl_mdio.h diff --git a/csl_mdiohal.h b/include/csl/csl_mdiohal.h similarity index 100% rename from csl_mdiohal.h rename to include/csl/csl_mdiohal.h diff --git a/csl_pci.h b/include/csl/csl_pci.h similarity index 100% rename from csl_pci.h rename to include/csl/csl_pci.h diff --git a/csl_pcihal.h b/include/csl/csl_pcihal.h similarity index 100% rename from csl_pcihal.h rename to include/csl/csl_pcihal.h diff --git a/csl_pll.h b/include/csl/csl_pll.h similarity index 100% rename from csl_pll.h rename to include/csl/csl_pll.h diff --git a/csl_pllhal.h b/include/csl/csl_pllhal.h similarity index 100% rename from csl_pllhal.h rename to include/csl/csl_pllhal.h diff --git a/csl_pwr.h b/include/csl/csl_pwr.h similarity index 100% rename from csl_pwr.h rename to include/csl/csl_pwr.h diff --git a/csl_pwrhal.h b/include/csl/csl_pwrhal.h similarity index 100% rename from csl_pwrhal.h rename to include/csl/csl_pwrhal.h diff --git a/csl_stdinc.h b/include/csl/csl_stdinc.h similarity index 100% rename from csl_stdinc.h rename to include/csl/csl_stdinc.h diff --git a/csl_stdinchal.h b/include/csl/csl_stdinchal.h similarity index 100% rename from csl_stdinchal.h rename to include/csl/csl_stdinchal.h diff --git a/csl_tcp.h b/include/csl/csl_tcp.h similarity index 100% rename from csl_tcp.h rename to include/csl/csl_tcp.h diff --git a/csl_tcphal.h b/include/csl/csl_tcphal.h similarity index 100% rename from csl_tcphal.h rename to include/csl/csl_tcphal.h diff --git a/csl_timer.h b/include/csl/csl_timer.h similarity index 100% rename from csl_timer.h rename to include/csl/csl_timer.h diff --git a/csl_timerhal.h b/include/csl/csl_timerhal.h similarity index 100% rename from csl_timerhal.h rename to include/csl/csl_timerhal.h diff --git a/csl_utop.h b/include/csl/csl_utop.h similarity index 100% rename from csl_utop.h rename to include/csl/csl_utop.h diff --git a/csl_utophal.h b/include/csl/csl_utophal.h similarity index 100% rename from csl_utophal.h rename to include/csl/csl_utophal.h diff --git a/csl_vcp.h b/include/csl/csl_vcp.h similarity index 100% rename from csl_vcp.h rename to include/csl/csl_vcp.h diff --git a/csl_vcphal.h b/include/csl/csl_vcphal.h similarity index 100% rename from csl_vcphal.h rename to include/csl/csl_vcphal.h diff --git a/csl_version.h b/include/csl/csl_version.h similarity index 100% rename from csl_version.h rename to include/csl/csl_version.h diff --git a/csl_vic.h b/include/csl/csl_vic.h similarity index 100% rename from csl_vic.h rename to include/csl/csl_vic.h diff --git a/csl_vichal.h b/include/csl/csl_vichal.h similarity index 100% rename from csl_vichal.h rename to include/csl/csl_vichal.h diff --git a/csl_vp.h b/include/csl/csl_vp.h similarity index 100% rename from csl_vp.h rename to include/csl/csl_vp.h diff --git a/csl_vphal.h b/include/csl/csl_vphal.h similarity index 100% rename from csl_vphal.h rename to include/csl/csl_vphal.h diff --git a/csl_xbus.h b/include/csl/csl_xbus.h similarity index 100% rename from csl_xbus.h rename to include/csl/csl_xbus.h diff --git a/csl_xbushal.h b/include/csl/csl_xbushal.h similarity index 100% rename from csl_xbushal.h rename to include/csl/csl_xbushal.h diff --git a/tistdtypes.h b/include/csl/tistdtypes.h similarity index 100% rename from tistdtypes.h rename to include/csl/tistdtypes.h diff --git a/_csl_irq.c b/src/_csl_irq.c similarity index 100% rename from _csl_irq.c rename to src/_csl_irq.c diff --git a/csl.c b/src/csl.c similarity index 100% rename from csl.c rename to src/csl.c diff --git a/csl_atl.c b/src/csl_atl.c similarity index 100% rename from csl_atl.c rename to src/csl_atl.c diff --git a/csl_cache.c b/src/csl_cache.c similarity index 100% rename from csl_cache.c rename to src/csl_cache.c diff --git a/csl_chip.c b/src/csl_chip.c similarity index 100% rename from csl_chip.c rename to src/csl_chip.c diff --git a/csl_chiphal.inc b/src/csl_chiphal.inc similarity index 100% rename from csl_chiphal.inc rename to src/csl_chiphal.inc diff --git a/csl_dat.c b/src/csl_dat.c similarity index 100% rename from csl_dat.c rename to src/csl_dat.c diff --git a/csl_dat_.sa b/src/csl_dat_.sa similarity index 100% rename from csl_dat_.sa rename to src/csl_dat_.sa diff --git a/csl_dma.c b/src/csl_dma.c similarity index 100% rename from csl_dma.c rename to src/csl_dma.c diff --git a/csl_edma.c b/src/csl_edma.c similarity index 100% rename from csl_edma.c rename to src/csl_edma.c diff --git a/csl_edmadsptr.c b/src/csl_edmadsptr.c similarity index 100% rename from csl_edmadsptr.c rename to src/csl_edmadsptr.c diff --git a/csl_emac.c b/src/csl_emac.c similarity index 100% rename from csl_emac.c rename to src/csl_emac.c diff --git a/csl_emif.c b/src/csl_emif.c similarity index 100% rename from csl_emif.c rename to src/csl_emif.c diff --git a/csl_emifa.c b/src/csl_emifa.c similarity index 100% rename from csl_emifa.c rename to src/csl_emifa.c diff --git a/csl_emifb.c b/src/csl_emifb.c similarity index 100% rename from csl_emifb.c rename to src/csl_emifb.c diff --git a/csl_emu.c b/src/csl_emu.c similarity index 100% rename from csl_emu.c rename to src/csl_emu.c diff --git a/csl_gpio.c b/src/csl_gpio.c similarity index 100% rename from csl_gpio.c rename to src/csl_gpio.c diff --git a/csl_hpi.c b/src/csl_hpi.c similarity index 100% rename from csl_hpi.c rename to src/csl_hpi.c diff --git a/csl_i2c.c b/src/csl_i2c.c similarity index 100% rename from csl_i2c.c rename to src/csl_i2c.c diff --git a/csl_irq.c b/src/csl_irq.c similarity index 100% rename from csl_irq.c rename to src/csl_irq.c diff --git a/csl_legacy.c b/src/csl_legacy.c similarity index 100% rename from csl_legacy.c rename to src/csl_legacy.c diff --git a/csl_mcasp.c b/src/csl_mcasp.c similarity index 100% rename from csl_mcasp.c rename to src/csl_mcasp.c diff --git a/csl_mcbsp.c b/src/csl_mcbsp.c similarity index 100% rename from csl_mcbsp.c rename to src/csl_mcbsp.c diff --git a/csl_mdio.c b/src/csl_mdio.c similarity index 100% rename from csl_mdio.c rename to src/csl_mdio.c diff --git a/csl_pci.c b/src/csl_pci.c similarity index 100% rename from csl_pci.c rename to src/csl_pci.c diff --git a/csl_pll.c b/src/csl_pll.c similarity index 100% rename from csl_pll.c rename to src/csl_pll.c diff --git a/csl_pwr.c b/src/csl_pwr.c similarity index 100% rename from csl_pwr.c rename to src/csl_pwr.c diff --git a/csl_tcp.c b/src/csl_tcp.c similarity index 100% rename from csl_tcp.c rename to src/csl_tcp.c diff --git a/csl_timer.c b/src/csl_timer.c similarity index 100% rename from csl_timer.c rename to src/csl_timer.c diff --git a/csl_utop.c b/src/csl_utop.c similarity index 100% rename from csl_utop.c rename to src/csl_utop.c diff --git a/csl_vcp.c b/src/csl_vcp.c similarity index 100% rename from csl_vcp.c rename to src/csl_vcp.c diff --git a/csl_vers.c b/src/csl_vers.c similarity index 100% rename from csl_vers.c rename to src/csl_vers.c diff --git a/csl_vic.c b/src/csl_vic.c similarity index 100% rename from csl_vic.c rename to src/csl_vic.c diff --git a/csl_vp.c b/src/csl_vp.c similarity index 100% rename from csl_vp.c rename to src/csl_vp.c diff --git a/csl_xbus.c b/src/csl_xbus.c similarity index 100% rename from csl_xbus.c rename to src/csl_xbus.c