aboutsummaryrefslogtreecommitdiff
path: root/secure_fw/partitions/firmware_update/CMakeLists.txt
blob: f7753d8e68e61570822677f5e11baccac4c3f6c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#-------------------------------------------------------------------------------
# Copyright (c) 2021, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------

if (NOT TFM_PARTITION_FIRMWARE_UPDATE)
    return()
endif()

cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0079 NEW)

add_library(tfm_psa_rot_partition_fwu STATIC)

target_include_directories(tfm_psa_rot_partition_fwu
    INTERFACE
        ${CMAKE_SOURCE_DIR}/secure_fw/include/tfm
    PRIVATE
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/firmware_update
)
target_include_directories(tfm_partitions
    INTERFACE
        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/firmware_update
)

target_sources(tfm_psa_rot_partition_fwu
    PRIVATE
        tfm_fwu_req_mngr.c
        tfm_fwu.c
        $<$<BOOL:${TFM_PSA_API}>:
        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/firmware_update/auto_generated/intermedia_tfm_firmware_update.c>
)
target_sources(tfm_partitions
    INTERFACE
        $<$<BOOL:${TFM_PSA_API}>:
            ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/firmware_update/auto_generated/static_info_tfm_firmware_update.c>
)

# Include the bootloader specific configuration.
if ((NOT TFM_FWU_BOOTLOADER_LIB) OR (NOT EXISTS ${TFM_FWU_BOOTLOADER_LIB}))
    message(FATAL_ERROR "TFM_FWU_BOOTLOADER_LIB invalid")
endif()

include(${TFM_FWU_BOOTLOADER_LIB})

target_link_libraries(tfm_psa_rot_partition_fwu
    PRIVATE
        tfm_secure_api
        psa_interface
        platform_s
        tfm_sprt
)

target_compile_definitions(tfm_psa_rot_partition_fwu
    PRIVATE
        $<$<BOOL:${TFM_PSA_API}>:TFM_PSA_API>
)

############################ Secure API ########################################

target_sources(tfm_secure_api
    INTERFACE
        ${CMAKE_CURRENT_SOURCE_DIR}/tfm_fwu_secure_api.c
)

# The veneers give warnings about not being properly declared so they get hidden
# to not overshadow _real_ warnings.
set_source_files_properties(tfm_fwu_secure_api.c
    PROPERTIES
        COMPILE_FLAGS -Wno-implicit-function-declaration
)

############################ Partition Defs ####################################

target_link_libraries(tfm_partitions
    INTERFACE
        tfm_psa_rot_partition_fwu
)

target_compile_definitions(tfm_partition_defs
    INTERFACE
    TFM_PARTITION_FIRMWARE_UPDATE
)