1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
3# Copyright (c) 2020, Nordic Semiconductor ASA.
4# Copyright (c) 2021, Laird Connectivity.
5#
6# SPDX-License-Identifier: BSD-3-Clause
7#
8#-------------------------------------------------------------------------------
9
10cmake_policy(SET CMP0076 NEW)
11set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
12
13add_subdirectory(../core nrf_common)
14
15set(NRF_FOLDER_PATH ${NRF_PLATFORM_PATH}/common/nrf5340)
16
17#========================= Platform common defs ===============================#
18
19# Specify the location of platform specific build dependencies.
20target_sources(tfm_s
21    PRIVATE
22    $<$<C_COMPILER_ID:GNU>:${CMAKE_CURRENT_SOURCE_DIR}/${NRF_PLATFORM_PATH}/common/core/startup_nrf5340.c>
23)
24
25if(NS)
26    target_sources(tfm_ns
27        PRIVATE
28            $<$<C_COMPILER_ID:GNU>:${CMAKE_CURRENT_SOURCE_DIR}/${NRF_PLATFORM_PATH}/common/core/startup_nrf5340.c>
29    )
30endif()
31
32if(BL2)
33    target_sources(bl2
34        PRIVATE
35            $<$<C_COMPILER_ID:GNU>:${CMAKE_CURRENT_SOURCE_DIR}/${NRF_PLATFORM_PATH}/common/core/startup_nrf5340.c>
36    )
37endif()
38
39#========================= Platform Secure ====================================#
40
41target_include_directories(platform_s
42    PUBLIC
43        .
44        ${NRF_PLATFORM_PATH}/common/core
45)
46
47target_sources(platform_s
48    PRIVATE
49        ${HAL_NORDIC_PATH}/nrfx/mdk/system_nrf5340_application.c
50)
51
52target_compile_definitions(platform_s
53    PUBLIC
54        NRF5340_XXAA_APPLICATION
55        NRF_SKIP_FICR_NS_COPY_TO_RAM
56        $<$<BOOL:${SECURE_QSPI}>:SECURE_QSPI>
57)
58
59#========================= Platform Non-Secure ================================#
60
61target_include_directories(platform_ns
62    PUBLIC
63        .
64        ${NRF_PLATFORM_PATH}/common/core
65)
66
67target_sources(platform_ns
68    PRIVATE
69        ${HAL_NORDIC_PATH}/nrfx/mdk/system_nrf5340_application.c
70)
71
72target_compile_definitions(platform_ns
73    PUBLIC
74        NRF5340_XXAA_APPLICATION
75        NRF_TRUSTZONE_NONSECURE
76        DOMAIN_NS=1
77)
78
79#========================= Platform BL2 =======================================#
80
81if(BL2)
82    target_include_directories(platform_bl2
83        PUBLIC
84            ${NRF_PLATFORM_PATH}/common/core
85        PRIVATE
86            .
87    )
88
89    target_sources(platform_bl2
90        PRIVATE
91            ${HAL_NORDIC_PATH}/nrfx/mdk/system_nrf5340_application.c
92    )
93
94    target_compile_definitions(platform_bl2
95        PUBLIC
96            NRF5340_XXAA_APPLICATION
97            NRF_SKIP_FICR_NS_COPY_TO_RAM
98    )
99endif()
100
101#========================= tfm_spm ============================================#
102
103target_sources(tfm_spm
104    PRIVATE
105        ${CMAKE_CURRENT_SOURCE_DIR}/${NRF_FOLDER_PATH}/tfm_interrupts.c
106)
107