Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame^] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2020-2021, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | if (NOT TFM_PARTITION_EXAMPLE) |
| 9 | return() |
| 10 | endif() |
| 11 | |
| 12 | cmake_minimum_required(VERSION 3.15) |
| 13 | cmake_policy(SET CMP0079 NEW) |
| 14 | |
| 15 | # The name of the target is required to be of the pattern |
| 16 | # tfm_app_rot_partition_x or tfm_psa_rot_partition_x, as it affects how the |
| 17 | # linker script will lay the partition in memory. |
| 18 | add_library(tfm_app_rot_partition_example STATIC) |
| 19 | |
| 20 | # Add the source files generated by parse tools when building. The intermedia |
| 21 | # file defines the partition stack. The load info file includes the static data |
| 22 | # of the partition. |
| 23 | target_sources(tfm_app_rot_partition_example |
| 24 | PRIVATE |
| 25 | tfm_example_partition.c |
| 26 | $<$<BOOL:${TFM_PSA_API}>: |
| 27 | ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/example_partition/auto_generated/intermedia_tfm_example_partition.c> |
| 28 | ) |
| 29 | target_sources(tfm_partitions |
| 30 | INTERFACE |
| 31 | $<$<BOOL:${TFM_PSA_API}>: |
| 32 | ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/example_partition/auto_generated/load_info_tfm_example_partition.c> |
| 33 | ) |
| 34 | |
| 35 | target_include_directories(tfm_app_rot_partition_example |
| 36 | PRIVATE |
| 37 | $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> |
| 38 | PUBLIC |
| 39 | ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/example_partition |
| 40 | ) |
| 41 | |
| 42 | target_link_libraries(tfm_app_rot_partition_example |
| 43 | PRIVATE |
| 44 | tfm_secure_api |
| 45 | psa_interface |
| 46 | platform_s |
| 47 | tfm_sprt |
| 48 | ) |
| 49 | |
| 50 | ############################ Secure API ######################################## |
| 51 | |
| 52 | target_sources(tfm_secure_api |
| 53 | INTERFACE |
| 54 | ${CMAKE_CURRENT_SOURCE_DIR}/tfm_example_partition_secure_api.c |
| 55 | ) |
| 56 | |
| 57 | # The veneers give warnings about not being properly declared so they get hidden |
| 58 | # to not overshadow _real_ warnings. |
| 59 | set_source_files_properties(tfm_example_partition_secure_api.c |
| 60 | PROPERTIES |
| 61 | COMPILE_FLAGS -Wno-implicit-function-declaration |
| 62 | ) |
| 63 | |
| 64 | ############################ Partition Defs #################################### |
| 65 | |
| 66 | target_link_libraries(tfm_partitions |
| 67 | INTERFACE |
| 68 | tfm_app_rot_partition_example |
| 69 | ) |
| 70 | |
| 71 | target_compile_definitions(tfm_partition_defs |
| 72 | INTERFACE |
| 73 | TFM_PARTITION_EXAMPLE |
| 74 | ) |