1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2024, 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_NS_TARGET mtb-pdl-cat1_lib_ns)
21add_subdirectory(libs/mtb-pdl-cat1/mtb-pdl-cat1_ns_lib)
22
23#========================= Platform common defs ===============================#
24
25add_library(platform_ns)
26
27target_sources(platform_ns
28    INTERFACE
29        $<$<C_COMPILER_ID:ARMClang>:${CMAKE_CURRENT_SOURCE_DIR}/Device/Source/armclang/startup_psoc64_ns.s>
30        $<$<C_COMPILER_ID:ARMClang>:${CY_MTB_PDL_CAT1_LIB_PATH}/drivers/source/TOOLCHAIN_ARM/cy_syslib_mdk.s>
31        $<$<C_COMPILER_ID:GNU>:${CMAKE_CURRENT_SOURCE_DIR}/Device/Source/gcc/startup_psoc64_ns.S>
32        $<$<C_COMPILER_ID:GNU>:${CY_MTB_PDL_CAT1_LIB_PATH}/drivers/source/TOOLCHAIN_GCC_ARM/cy_syslib_gcc.S>
33        $<$<C_COMPILER_ID:IAR>:${CMAKE_CURRENT_SOURCE_DIR}/Device/Source/iar/startup_psoc64_ns.s>
34        $<$<C_COMPILER_ID:IAR>:${CY_MTB_PDL_CAT1_LIB_PATH}/drivers/source/TOOLCHAIN_IAR/cy_syslib_iar.s>
35)
36
37target_sources(platform_ns
38    PRIVATE
39        ./mailbox/platform_ns_mailbox.c
40        ./Device/Source/system_psoc6_cm4.c
41        ./Device/Source/psoc6_system_init_cm4.c
42        ./Native_Driver/generated_source/cycfg.c
43        ./Native_Driver/generated_source/cycfg_clocks.c
44        ./Native_Driver/generated_source/cycfg_clocks.c
45        ./Native_Driver/generated_source/cycfg_peripherals.c
46        ./Native_Driver/generated_source/cycfg_pins.c
47        ./Native_Driver/generated_source/cycfg_routing.c
48        ./Native_Driver/generated_source/cycfg_system.c
49        ./Native_Driver/generated_source/cycfg_qspi_memslot.c
50        ./mailbox/platform_multicore.c
51        ./CMSIS_Driver/Driver_USART.c
52        ./Device/Source/device_definition.c
53        $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/plat_test.c>
54)
55
56target_include_directories(platform_ns
57    PUBLIC
58        .
59        ./include
60        ./partition
61        Device/Config
62        Device/Include
63        ext/cmsis/Include
64        ext/cmsis/Include/m-profile
65        ext/common
66        ${CY_MTB_PDL_CAT1_LIB_PATH}/drivers/include
67        ${CY_MTB_PDL_CAT1_LIB_PATH}/devices/COMPONENT_CAT1A/include
68        ${CY_CORE_LIB_PATH}/include
69        Native_Driver/generated_source
70        CMSIS_Driver/Config
71    PRIVATE
72        ${CY_MTB_PDL_CAT1_LIB_PATH}/cmsis/include
73)
74
75target_compile_definitions(platform_ns
76    PUBLIC
77        RTE_USART5
78)
79
80target_link_libraries(platform_ns
81    PRIVATE
82        ${MTB_PDL_CAT1_LIB_NS_TARGET}
83)
84
85# Include region_defs.h and flash_layout.h
86target_include_directories(platform_region_defs
87    INTERFACE
88        partition
89)
90