1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
3# Copyright (c) 2022 Cypress Semiconductor Corporationn (an Infineon company)
4# or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
5#
6# SPDX-License-Identifier: BSD-3-Clause
7#
8#-------------------------------------------------------------------------------
9
10add_library(CMSIS_5_RTX_V8MMN STATIC IMPORTED GLOBAL)
11add_library(CMSIS_5_RTX_V8MMFN STATIC IMPORTED GLOBAL)
12add_library(CMSIS_5_RTX_V8MBN STATIC IMPORTED GLOBAL)
13add_library(CMSIS_5_RTX_CM3 STATIC IMPORTED GLOBAL)
14
15if ("${CMAKE_C_COMPILER_ID}" STREQUAL GNU)
16    set_target_properties(CMSIS_5_RTX_V8MMN PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/GCC/libRTX_V8MMN.a)
17    set_target_properties(CMSIS_5_RTX_V8MMFN PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/GCC/libRTX_V8MMFN.a)
18    set_target_properties(CMSIS_5_RTX_V8MBN PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/GCC/libRTX_V8MBN.a)
19    set_target_properties(CMSIS_5_RTX_CM3   PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/GCC/libRTX_CM3.a)
20elseif("${CMAKE_C_COMPILER_ID}" STREQUAL ARMClang)
21    set_target_properties(CMSIS_5_RTX_V8MMN PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/ARM/RTX_V8MMN.lib)
22    set_target_properties(CMSIS_5_RTX_V8MMFN PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/ARM/RTX_V8MMFN.lib)
23    set_target_properties(CMSIS_5_RTX_V8MBN PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/ARM/RTX_V8MBN.lib)
24    set_target_properties(CMSIS_5_RTX_CM3   PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/ARM/RTX_CM3.lib)
25elseif("${CMAKE_C_COMPILER_ID}" STREQUAL IAR)
26    add_library(CMSIS_5_RTX_V81MMN STATIC IMPORTED GLOBAL)
27    set_target_properties(CMSIS_5_RTX_V8MMN PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/IAR/RTX_V8MMN.a)
28    set_target_properties(CMSIS_5_RTX_V81MMN PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/IAR/RTX_V81MMN.a)
29    set_target_properties(CMSIS_5_RTX_V8MMFN PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/IAR/RTX_V8MMFN.a)
30    set_target_properties(CMSIS_5_RTX_V8MBN PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/IAR/RTX_V8MBN.a)
31    set_target_properties(CMSIS_5_RTX_CM3   PROPERTIES IMPORTED_LOCATION ${CMSIS_5_PATH}/RTOS2/RTX/Library/IAR/RTX_CM3.a)
32    if (CONFIG_TFM_USE_TRUSTZONE)
33        target_link_libraries(CMSIS_5_RTX_V81MMN
34            INTERFACE
35                tfm_s_veneers
36        )
37    endif()
38else()
39    message(FATAL_ERROR "${CMAKE_C_COMPILER_ID} does not have CMSIS RTX static libraries set up")
40endif()
41
42if (CONFIG_TFM_USE_TRUSTZONE)
43    target_link_libraries(CMSIS_5_RTX_V8MMN
44        INTERFACE
45            tfm_s_veneers
46    )
47
48    target_link_libraries(CMSIS_5_RTX_V8MMFN
49        INTERFACE
50            tfm_s_veneers
51    )
52
53    target_link_libraries(CMSIS_5_RTX_V8MBN
54        INTERFACE
55            tfm_s_veneers
56    )
57endif()
58