1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
3# Copyright (c) 2020-2022 Cypress Semiconductor Corporation (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
10cmake_policy(SET CMP0076 NEW)
11cmake_policy(SET CMP0079 NEW)
12set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
13
14set (CY_PLATFORM_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
15set (CY_CORE_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libs/core-lib)
16set (CY_PSOC64_DIR    ${CMAKE_CURRENT_SOURCE_DIR})
17
18#========================= Libraries ==========================================#
19
20set(MTB_PDL_CAT1_LIB_S_TARGET  mtb-pdl-cat1_lib_s)
21set(P64_UTILS_LIB_TARGET   p64_utils_lib)
22
23add_subdirectory(libs/mtb-pdl-cat1/mtb-pdl-cat1_s_lib)
24add_subdirectory(libs/p64_utils)
25
26#========================= Platform region defs ===============================#
27
28target_include_directories(platform_region_defs
29    INTERFACE
30        partition
31)
32target_compile_definitions(platform_region_defs
33    INTERFACE
34        $<$<BOOL:${TEST_PSA_API}>:PSA_API_TEST_ENABLED>
35)
36
37#========================= Platform common defs ===============================#
38
39target_sources(tfm_s
40    PRIVATE
41        $<$<C_COMPILER_ID:ARMClang>:${CMAKE_CURRENT_SOURCE_DIR}/Device/Source/armclang/startup_psoc64_s.s>
42        $<$<C_COMPILER_ID:ARMClang>:${CY_MTB_PDL_CAT1_LIB_PATH}/drivers/source/TOOLCHAIN_ARM/cy_syslib_mdk.s>
43        $<$<C_COMPILER_ID:GNU>:${CMAKE_CURRENT_SOURCE_DIR}/Device/Source/gcc/startup_psoc64_s.S>
44        $<$<C_COMPILER_ID:GNU>:${CY_MTB_PDL_CAT1_LIB_PATH}/drivers/source/TOOLCHAIN_GCC_ARM/cy_syslib_gcc.S>
45        $<$<C_COMPILER_ID:IAR>:${CMAKE_CURRENT_SOURCE_DIR}/Device/Source/iar/startup_psoc64_s.s>
46        $<$<C_COMPILER_ID:IAR>:${CY_MTB_PDL_CAT1_LIB_PATH}/drivers/source/TOOLCHAIN_IAR/cy_syslib_iar.s>
47)
48target_add_scatter_file(tfm_s
49    $<$<C_COMPILER_ID:ARMClang>:${PLATFORM_DIR}/ext/common/armclang/tfm_common_s.sct>
50    $<$<C_COMPILER_ID:GNU>:${PLATFORM_DIR}/ext/common/gcc/tfm_common_s.ld>
51    $<$<C_COMPILER_ID:IAR>:${PLATFORM_DIR}/ext/common/iar/tfm_common_s.icf>
52)
53
54#========================= Platform Secure ====================================#
55
56target_include_directories(platform_s
57    PUBLIC
58        .
59        Device/Config
60        Device/Include
61        ${CY_MTB_PDL_CAT1_LIB_PATH}/drivers/include
62        ${CY_MTB_PDL_CAT1_LIB_PATH}/devices/COMPONENT_CAT1A/include
63        ${CY_CORE_LIB_PATH}/include
64        Native_Driver/generated_source
65        ./CMSIS_Driver/Config
66        mailbox
67    PRIVATE
68        ${CY_MTB_PDL_CAT1_LIB_PATH}/cmsis/include
69)
70
71target_sources(platform_s
72    PRIVATE
73        ./mailbox/platform_multicore.c
74        ./mailbox/platform_spe_mailbox.c
75        ./Device/Source/system_psoc6_cm0plus.c
76        ./Device/Source/psoc6_system_init_cm0p.c
77        ./Native_Driver/generated_source/cycfg.c
78        ./Native_Driver/generated_source/cycfg_clocks.c
79        ./Native_Driver/generated_source/cycfg_clocks.c
80        ./Native_Driver/generated_source/cycfg_peripherals.c
81        ./Native_Driver/generated_source/cycfg_pins.c
82        ./Native_Driver/generated_source/cycfg_routing.c
83        ./Native_Driver/generated_source/cycfg_system.c
84        ./Native_Driver/generated_source/cycfg_qspi_memslot.c
85        ./CMSIS_Driver/Driver_Flash.c
86        ./CMSIS_Driver/Driver_USART.c
87        ./driver_smpu.c
88        ./driver_ppu.c
89        ./driver_dap.c
90        ./Device/Source/device_definition.c
91        $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/plat_test.c>
92        $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/services/src/tfm_platform_system.c>
93)
94
95target_compile_definitions(platform_s
96    PRIVATE
97        RTE_USART5
98)
99
100target_link_libraries(platform_s
101    PUBLIC
102        ${MTB_PDL_CAT1_LIB_S_TARGET}
103        ${P64_UTILS_LIB_TARGET}
104)
105
106#========================= ns_agent_mailbox ===================================#
107
108target_sources(tfm_psa_rot_partition_ns_agent_mailbox
109    PRIVATE
110        tfm_hal_multi_core.c
111)
112
113#========================= tfm_spm ============================================#
114
115target_sources(tfm_spm
116    PRIVATE
117        ./target_cfg.c
118        ./tfm_interrupts.c
119        ./tfm_hal_isolation.c
120        ./tfm_hal_platform.c
121)
122
123include(./install.cmake)
124