1 # support for the Analog Devices toolchain for their DSPs
2 # Raphael Cotty" <raphael.cotty (AT) googlemail.com>
4 # it supports three architectures:
13 SET(CMAKE_STATIC_LIBRARY_SUFFIX ".dlb")
14 SET(CMAKE_SHARED_LIBRARY_SUFFIX "")
15 SET(CMAKE_EXECUTABLE_SUFFIX ".dxe")
17 # if ADSP_PROCESSOR has not been set, but CMAKE_SYSTEM_PROCESSOR has,
18 # assume that this is the processor name to use for the compiler
19 IF(CMAKE_SYSTEM_PROCESSOR AND NOT ADSP_PROCESSOR)
20 SET(ADSP_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
21 ENDIF(CMAKE_SYSTEM_PROCESSOR AND NOT ADSP_PROCESSOR)
23 # if ADSP_PROCESSOR_SILICIUM_REVISION has not been set, use "none"
24 IF(NOT ADSP_PROCESSOR_SILICIUM_REVISION)
25 SET(ADSP_PROCESSOR_SILICIUM_REVISION "none")
26 ENDIF(NOT ADSP_PROCESSOR_SILICIUM_REVISION)
28 # this file is included from the C and CXX files, so handle both here
30 GET_FILENAME_COMPONENT(_ADSP_DIR "${CMAKE_C_COMPILER}" PATH)
32 GET_FILENAME_COMPONENT(_ADSP_DIR "${CMAKE_CXX_COMPILER}" PATH)
35 GET_FILENAME_COMPONENT(_ADSP_DIR "${CMAKE_ASM_COMPILER}" PATH)
40 IF(CMAKE_C_COMPILER MATCHES ccblkfn OR CMAKE_CXX_COMPILER MATCHES ccblkfn OR CMAKE_ASM_COMPILER MATCHES easmBLKFN)
41 IF(NOT ADSP_PROCESSOR)
42 SET(ADSP_PROCESSOR "ADSP-BF561")
43 ENDIF(NOT ADSP_PROCESSOR)
44 SET(ADSP_BLACKFIN TRUE)
45 SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/Blackfin")
46 ENDIF(CMAKE_C_COMPILER MATCHES ccblkfn OR CMAKE_CXX_COMPILER MATCHES ccblkfn OR CMAKE_ASM_COMPILER MATCHES easmBLKFN)
48 IF(CMAKE_C_COMPILER MATCHES ccts OR CMAKE_CXX_COMPILER MATCHES ccts OR CMAKE_ASM_COMPILER MATCHES easmTS)
49 IF(NOT ADSP_PROCESSOR)
50 SET(ADSP_PROCESSOR "ADSP-TS101")
51 ENDIF(NOT ADSP_PROCESSOR)
53 SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/TS")
54 ENDIF(CMAKE_C_COMPILER MATCHES ccts OR CMAKE_CXX_COMPILER MATCHES ccts OR CMAKE_ASM_COMPILER MATCHES easmTS)
56 IF(CMAKE_C_COMPILER MATCHES cc21k OR CMAKE_CXX_COMPILER MATCHES cc21k OR CMAKE_ASM_COMPILER MATCHES easm21k)
57 IF(NOT ADSP_PROCESSOR)
58 SET(ADSP_PROCESSOR "ADSP-21060")
59 ENDIF(NOT ADSP_PROCESSOR)
62 SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k") # default if nothing matches
63 IF (ADSP_PROCESSOR MATCHES "210..$")
64 SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k")
65 ENDIF(ADSP_PROCESSOR MATCHES "210..$")
67 IF (ADSP_PROCESSOR MATCHES "211..$")
68 SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/211k")
69 ENDIF(ADSP_PROCESSOR MATCHES "211..$")
71 IF (ADSP_PROCESSOR MATCHES "212..$")
72 SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/212k")
73 ENDIF(ADSP_PROCESSOR MATCHES "212..$")
75 IF (ADSP_PROCESSOR MATCHES "213..$")
76 SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/213k")
77 ENDIF(ADSP_PROCESSOR MATCHES "213..$")
79 SET(_ADSP_FAMILY_DIR "${_ADSP_DIR}/21k")
80 ENDIF(CMAKE_C_COMPILER MATCHES cc21k OR CMAKE_CXX_COMPILER MATCHES cc21k OR CMAKE_ASM_COMPILER MATCHES easm21k)
83 LINK_DIRECTORIES("${_ADSP_FAMILY_DIR}/lib")
86 FIND_PROGRAM( ADSP_VDKGEN_EXECUTABLE vdkgen "${_ADSP_FAMILY_DIR}/vdk" )
88 MACRO(ADSP_GENERATE_VDK VDK_GENERATED_HEADER VDK_GENERATED_SOURCE VDK_KERNEL_SUPPORT_FILE)
90 OUTPUT ${VDK_GENERATED_HEADER} ${VDK_GENERATED_SOURCE}
91 COMMAND ${ADSP_VDKGEN_EXECUTABLE} ${VDK_KERNEL_SUPPORT_FILE} -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -MM
92 DEPENDS ${VDK_KERNEL_SUPPORT_FILE}
94 ENDMACRO(ADSP_GENERATE_VDK VDK_GENERATED_HEADER VDK_GENERATED_SOURCE VDK_KERNEL_SUPPORT_FILE)
97 FIND_PROGRAM( ADSP_ELFLOADER_EXECUTABLE elfloader "${_ADSP_FAMILY_DIR}" )
99 # BOOT_MODE: prom, flash, spi, spislave, UART, TWI, FIFO
100 # FORMAT: hex, ASCII, binary, include
102 MACRO(ADSP_CREATE_LOADER_FILE TARGET_NAME BOOT_MODE FORMAT WIDTH)
104 TARGET ${TARGET_NAME}
106 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
107 COMMENT "Building the loader file"
109 ENDMACRO(ADSP_CREATE_LOADER_FILE TARGET_NAME BOOT_MODE FORMAT WIDTH)
111 MACRO(ADSP_CREATE_LOADER_FILE_INIT TARGET_NAME BOOT_MODE FORMAT WIDTH INITIALIZATION_FILE)
113 TARGET ${TARGET_NAME}
115 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}
116 COMMENT "Building the loader file"
118 ENDMACRO(ADSP_CREATE_LOADER_FILE_INIT TARGET_NAME BOOT_MODE FORMAT WIDTH INITIALIZATION_FILE)