2007-07-12 21:41:00 +04:00
|
|
|
# support for the Analog Devices toolchain for their DSPs
|
|
|
|
# Raphael Cotty" <raphael.cotty (AT) googlemail.com>
|
|
|
|
#
|
|
|
|
# it supports three architectures:
|
|
|
|
# Blackfin
|
|
|
|
# TS (TigerShark)
|
|
|
|
# 21k (Sharc 21xxx)
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(NOT ADSP)
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
set(ADSP TRUE)
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_STATIC_LIBRARY_SUFFIX ".dlb")
|
|
|
|
set(CMAKE_SHARED_LIBRARY_SUFFIX "")
|
|
|
|
set(CMAKE_EXECUTABLE_SUFFIX ".dxe")
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
# if ADSP_PROCESSOR has not been set, but CMAKE_SYSTEM_PROCESSOR has,
|
2007-07-12 21:41:00 +04:00
|
|
|
# assume that this is the processor name to use for the compiler
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_SYSTEM_PROCESSOR AND NOT ADSP_PROCESSOR)
|
|
|
|
set(ADSP_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
|
|
|
# if ADSP_PROCESSOR_SILICIUM_REVISION has not been set, use "none"
|
2012-08-13 21:47:32 +04:00
|
|
|
if(NOT ADSP_PROCESSOR_SILICIUM_REVISION)
|
|
|
|
set(ADSP_PROCESSOR_SILICIUM_REVISION "none")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
|
|
|
# this file is included from the C and CXX files, so handle both here
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
get_filename_component(_ADSP_DIR "${CMAKE_C_COMPILER}" PATH)
|
|
|
|
if(NOT _ADSP_DIR)
|
|
|
|
get_filename_component(_ADSP_DIR "${CMAKE_CXX_COMPILER}" PATH)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
if(NOT _ADSP_DIR)
|
|
|
|
get_filename_component(_ADSP_DIR "${CMAKE_ASM_COMPILER}" PATH)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
|
|
|
# detect architecture
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_C_COMPILER MATCHES ccblkfn OR CMAKE_CXX_COMPILER MATCHES ccblkfn OR CMAKE_ASM_COMPILER MATCHES easmBLKFN)
|
|
|
|
if(NOT ADSP_PROCESSOR)
|
|
|
|
set(ADSP_PROCESSOR "ADSP-BF561")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(ADSP_BLACKFIN TRUE)
|
|
|
|
set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/Blackfin")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_C_COMPILER MATCHES ccts OR CMAKE_CXX_COMPILER MATCHES ccts OR CMAKE_ASM_COMPILER MATCHES easmTS)
|
|
|
|
if(NOT ADSP_PROCESSOR)
|
|
|
|
set(ADSP_PROCESSOR "ADSP-TS101")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(ADSP_TS TRUE)
|
|
|
|
set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/TS")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_C_COMPILER MATCHES cc21k OR CMAKE_CXX_COMPILER MATCHES cc21k OR CMAKE_ASM_COMPILER MATCHES easm21k)
|
|
|
|
if(NOT ADSP_PROCESSOR)
|
|
|
|
set(ADSP_PROCESSOR "ADSP-21060")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(ADSP_21K TRUE)
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") # default if nothing matches
|
|
|
|
if (ADSP_PROCESSOR MATCHES "210..$")
|
|
|
|
set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if (ADSP_PROCESSOR MATCHES "211..$")
|
|
|
|
set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/211k")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if (ADSP_PROCESSOR MATCHES "212..$")
|
|
|
|
set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/212k")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if (ADSP_PROCESSOR MATCHES "213..$")
|
|
|
|
set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/213k")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
set(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
link_directories("${_ADSP_FAMILY_DIR}/lib")
|
2007-07-12 21:41:00 +04:00
|
|
|
|
|
|
|
# vdk support
|
2012-08-13 21:47:32 +04:00
|
|
|
find_program( ADSP_VDKGEN_EXECUTABLE vdkgen "${_ADSP_FAMILY_DIR}/vdk" )
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
macro(ADSP_GENERATE_VDK VDK_GENERATED_HEADER VDK_GENERATED_SOURCE VDK_KERNEL_SUPPORT_FILE)
|
|
|
|
add_custom_command(
|
2007-07-12 21:41:00 +04:00
|
|
|
OUTPUT ${VDK_GENERATED_HEADER} ${VDK_GENERATED_SOURCE}
|
|
|
|
COMMAND ${ADSP_VDKGEN_EXECUTABLE} ${VDK_KERNEL_SUPPORT_FILE} -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -MM
|
|
|
|
DEPENDS ${VDK_KERNEL_SUPPORT_FILE}
|
|
|
|
)
|
2012-08-13 21:50:14 +04:00
|
|
|
endmacro()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
|
|
|
# loader support
|
2012-08-13 21:47:32 +04:00
|
|
|
find_program( ADSP_ELFLOADER_EXECUTABLE elfloader "${_ADSP_FAMILY_DIR}" )
|
2007-07-12 21:41:00 +04:00
|
|
|
|
|
|
|
# BOOT_MODE: prom, flash, spi, spislave, UART, TWI, FIFO
|
|
|
|
# FORMAT: hex, ASCII, binary, include
|
|
|
|
# WIDTH: 8, 16
|
2012-08-13 21:47:32 +04:00
|
|
|
macro(ADSP_CREATE_LOADER_FILE TARGET_NAME BOOT_MODE FORMAT WIDTH)
|
|
|
|
add_custom_command(
|
2007-07-12 21:41:00 +04:00
|
|
|
TARGET ${TARGET_NAME}
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${ADSP_ELFLOADER_EXECUTABLE} ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.dxe -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -b ${BOOT_MODE} -f ${FORMAT} -width ${WIDTH} -o ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.ldr
|
|
|
|
COMMENT "Building the loader file"
|
|
|
|
)
|
2012-08-13 21:50:14 +04:00
|
|
|
endmacro()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
macro(ADSP_CREATE_LOADER_FILE_INIT TARGET_NAME BOOT_MODE FORMAT WIDTH INITIALIZATION_FILE)
|
|
|
|
add_custom_command(
|
2007-07-12 21:41:00 +04:00
|
|
|
TARGET ${TARGET_NAME}
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${ADSP_ELFLOADER_EXECUTABLE} ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.dxe -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -b ${BOOT_MODE} -f ${FORMAT} -width ${WIDTH} -o ${EXECUTABLE_OUTPUT_PATH}/${TARGET_NAME}.ldr -init ${INITIALIZATION_FILE}
|
|
|
|
COMMENT "Building the loader file"
|
|
|
|
)
|
2012-08-13 21:50:14 +04:00
|
|
|
endmacro()
|
2007-07-12 21:41:00 +04:00
|
|
|
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|