Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 2 | # Copyright (c) 2020-2022, Arm Limited. All rights reserved. |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 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 | |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 20 | target_sources(tfm_app_rot_partition_example |
| 21 | PRIVATE |
| 22 | tfm_example_partition.c |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 23 | ) |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 24 | |
| 25 | # Add the source files generated by parse tools when building. |
| 26 | # The intermedia file defines the partition stack. |
| 27 | target_sources(tfm_app_rot_partition_example |
| 28 | PRIVATE |
| 29 | ${CMAKE_BINARY_DIR}/generated/example_partition/auto_generated/intermedia_tfm_example_partition.c |
| 30 | ) |
| 31 | |
| 32 | # The load info file includes the static data of the partition. |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 33 | target_sources(tfm_partitions |
| 34 | INTERFACE |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 35 | ${CMAKE_BINARY_DIR}/generated/example_partition/auto_generated/load_info_tfm_example_partition.c |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 36 | ) |
| 37 | |
Kevin Peng | 6256bf5 | 2023-08-29 11:20:59 +0800 | [diff] [blame] | 38 | # Add dependency to the manifest_tool |
| 39 | add_dependencies(tfm_app_rot_partition_example manifest_tool) |
| 40 | |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 41 | target_include_directories(tfm_app_rot_partition_example |
| 42 | PRIVATE |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 43 | ${CMAKE_CURRENT_SOURCE_DIR} |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 44 | PUBLIC |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 45 | ${CMAKE_BINARY_DIR}/generated/example_partition |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 46 | ) |
| 47 | |
| 48 | target_link_libraries(tfm_app_rot_partition_example |
| 49 | PRIVATE |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 50 | tfm_sprt |
| 51 | ) |
| 52 | |
| 53 | ############################ Secure API ######################################## |
| 54 | |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 55 | target_sources(tfm_sprt |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 56 | INTERFACE |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 57 | ${CMAKE_CURRENT_SOURCE_DIR}/tfm_example_partition_api.c |
| 58 | ) |
| 59 | |
| 60 | target_include_directories(tfm_sprt |
| 61 | PUBLIC |
| 62 | . |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 63 | ) |
| 64 | |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 65 | ############################ Partition Defs #################################### |
| 66 | |
| 67 | target_link_libraries(tfm_partitions |
| 68 | INTERFACE |
| 69 | tfm_app_rot_partition_example |
| 70 | ) |
| 71 | |
Xinyu Zhang | 9120413 | 2023-06-19 19:08:43 +0800 | [diff] [blame] | 72 | target_compile_definitions(tfm_config |
Anton Komlev | 4bfd6c5 | 2022-06-29 17:10:26 +0100 | [diff] [blame] | 73 | INTERFACE |
| 74 | TFM_PARTITION_EXAMPLE |
| 75 | ) |