diff options
19 files changed, 364 insertions, 2 deletions
diff --git a/platform/ext/common/armclang/tfm_common_s.sct b/platform/ext/common/armclang/tfm_common_s.sct index 4186d09cbd..ded5aabe7e 100644 --- a/platform/ext/common/armclang/tfm_common_s.sct +++ b/platform/ext/common/armclang/tfm_common_s.sct @@ -34,6 +34,11 @@ LR_CODE S_CODE_START S_CODE_SIZE { *psa_lifecycle.* (+RO) } + /**** Section for holding partition static data */ + TFM_SP_STATIC_LIST +0 ALIGN 4 { + *(.partition_info) + } + /**** PSA RoT RO part (CODE + RODATA) start here */ /* * This empty, zero long execution region is here to mark the start address diff --git a/platform/ext/common/armclang/tfm_isolation_l3.sct.template b/platform/ext/common/armclang/tfm_isolation_l3.sct.template index cb108df6f4..c25534bdce 100644 --- a/platform/ext/common/armclang/tfm_isolation_l3.sct.template +++ b/platform/ext/common/armclang/tfm_isolation_l3.sct.template @@ -40,6 +40,11 @@ LR_CODE S_CODE_START { * (+RO) } + /**** Section for holding partition static data */ + TFM_SP_STATIC_LIST +0 ALIGN 4 { + *(.partition_info) + } + /**** PSA RoT CODE + RO-data starts here */ {% for partition in partitions %} {% if partition.manifest.type == 'PSA-ROT' %} diff --git a/platform/ext/common/gcc/tfm_common_s.ld b/platform/ext/common/gcc/tfm_common_s.ld index 3939b6471f..e29fbd6680 100644 --- a/platform/ext/common/gcc/tfm_common_s.ld +++ b/platform/ext/common/gcc/tfm_common_s.ld @@ -141,6 +141,15 @@ SECTIONS Image$$TFM_UNPRIV_CODE$$RO$$Base = ADDR(.TFM_UNPRIV_CODE); Image$$TFM_UNPRIV_CODE$$RO$$Limit = ADDR(.TFM_UNPRIV_CODE) + SIZEOF(.TFM_UNPRIV_CODE); + /**** Section for holding partition static RO data */ + .TFM_SP_STATIC_LIST : ALIGN(4) + { + KEEP(*(.partition_info)) + } > FLASH + Image$$TFM_SP_STATIC_LIST$$RO$$Base = ADDR(.TFM_SP_STATIC_LIST); + Image$$TFM_SP_STATIC_LIST$$RO$$Limit = ADDR(.TFM_SP_STATIC_LIST) + SIZEOF(.TFM_SP_STATIC_LIST); + . = ALIGN(32); + /**** PSA RoT RO part (CODE + RODATA) start here */ Image$$TFM_PSA_CODE_START$$Base = .; diff --git a/platform/ext/common/gcc/tfm_isolation_l3.ld.template b/platform/ext/common/gcc/tfm_isolation_l3.ld.template index 493870eb25..ccbe7bcf03 100644 --- a/platform/ext/common/gcc/tfm_isolation_l3.ld.template +++ b/platform/ext/common/gcc/tfm_isolation_l3.ld.template @@ -101,6 +101,15 @@ SECTIONS . = ALIGN(32); Image$$PT_RO_START$$Base = .; + /**** Section for holding partition static RO data */ + .TFM_SP_STATIC_LIST : ALIGN(4) + { + KEEP(*(.partition_info)) + } > FLASH + Image$$TFM_SP_STATIC_LIST$$RO$$Base = ADDR(.TFM_SP_STATIC_LIST); + Image$$TFM_SP_STATIC_LIST$$RO$$Limit = ADDR(.TFM_SP_STATIC_LIST) + SIZEOF(.TFM_SP_STATIC_LIST); + . = ALIGN(32); + /**** PSA RoT RO CODE + RO-data starts here */ {% for partition in partitions %} {% if partition.manifest.type == 'PSA-ROT' %} diff --git a/platform/ext/common/iar/tfm_common_s.icf b/platform/ext/common/iar/tfm_common_s.icf index c9d49e9c05..542284b5c4 100644 --- a/platform/ext/common/iar/tfm_common_s.icf +++ b/platform/ext/common/iar/tfm_common_s.icf @@ -39,6 +39,11 @@ define block TFM_UNPRIV_CODE with alignment = 32 { ro object tfm_log_raw.o }; + /**** Section for holding partition static data */ +#define block TFM_SP_STATIC_LIST with alignment = 4 { + ro section .partition_info object static_info_*.o, +} + /**** PSA RoT RO part (CODE + RODATA) start here */ /* * This empty, zero long execution region is here to mark the start address @@ -196,6 +201,10 @@ define block SRAM_WATERMARK with size = 0 { }; define block LR_CODE with fixed order { block ER_TFM_CODE, block TFM_UNPRIV_CODE, + +/**** Section for holding partition static data */ + block TFM_SP_STATIC_LIST, + block TFM_PSA_CODE_START, block TFM_PSA_ROT_LINKER, diff --git a/secure_fw/CMakeLists.txt b/secure_fw/CMakeLists.txt index afe1d0f400..f75af4ea40 100644 --- a/secure_fw/CMakeLists.txt +++ b/secure_fw/CMakeLists.txt @@ -28,6 +28,7 @@ add_subdirectory(partitions/platform) add_subdirectory(partitions/psa_proxy) add_subdirectory(partitions/firmware_update) add_subdirectory(partitions/tfm_ffm11_partition) +add_subdirectory(partitions/ns_proxy_partition) add_subdirectory(spm) target_include_directories(secure_fw diff --git a/secure_fw/include/load/partition_static_load.h b/secure_fw/include/load/partition_static_load.h index 065c6db2b0..70248b6e66 100644 --- a/secure_fw/include/load/partition_static_load.h +++ b/secure_fw/include/load/partition_static_load.h @@ -24,7 +24,7 @@ #define POSITION_TO_PTR(x, t) (t)(x) /* Length of extendable variables in partition static type */ -#define STATIC_INFO_EXT_LENGTH 0 +#define STATIC_INFO_EXT_LENGTH 2 /* * Argument "ps_ptr" must have be a "struct partition_static_info_t *" type and * must be validated before using. diff --git a/secure_fw/partitions/crypto/CMakeLists.txt b/secure_fw/partitions/crypto/CMakeLists.txt index a99b685905..0f59870c47 100644 --- a/secure_fw/partitions/crypto/CMakeLists.txt +++ b/secure_fw/partitions/crypto/CMakeLists.txt @@ -33,12 +33,22 @@ target_sources(tfm_psa_rot_partition_crypto $<$<BOOL:${TFM_PSA_API}>: ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/crypto/auto_generated/intermedia_tfm_crypto.c> ) +target_sources(tfm_partitions + INTERFACE + $<$<BOOL:${TFM_PSA_API}>: + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/crypto/auto_generated/static_info_tfm_crypto.c> +) +# Set include directory target_include_directories(tfm_psa_rot_partition_crypto PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/crypto ) +target_include_directories(tfm_partitions + INTERFACE + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/crypto +) # Linking to external interfaces target_link_libraries(tfm_psa_rot_partition_crypto diff --git a/secure_fw/partitions/firmware_update/CMakeLists.txt b/secure_fw/partitions/firmware_update/CMakeLists.txt index 861e3d1329..f7753d8e68 100644 --- a/secure_fw/partitions/firmware_update/CMakeLists.txt +++ b/secure_fw/partitions/firmware_update/CMakeLists.txt @@ -21,6 +21,10 @@ target_include_directories(tfm_psa_rot_partition_fwu $<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 @@ -28,7 +32,12 @@ target_sources(tfm_psa_rot_partition_fwu 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})) diff --git a/secure_fw/partitions/initial_attestation/CMakeLists.txt b/secure_fw/partitions/initial_attestation/CMakeLists.txt index 9ba3abbdc9..aa34af2f4e 100644 --- a/secure_fw/partitions/initial_attestation/CMakeLists.txt +++ b/secure_fw/partitions/initial_attestation/CMakeLists.txt @@ -37,13 +37,23 @@ target_sources(tfm_psa_rot_partition_attestation $<$<BOOL:${TFM_PSA_API}>: ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/initial_attestation/auto_generated/intermedia_tfm_initial_attestation.c> ) +target_sources(tfm_partitions + INTERFACE + $<$<BOOL:${TFM_PSA_API}>: + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/initial_attestation/auto_generated/static_info_tfm_initial_attestation.c> +) +# Set include directory target_include_directories(tfm_psa_rot_partition_attestation PUBLIC . PRIVATE ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/initial_attestation ) +target_include_directories(tfm_partitions + INTERFACE + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/initial_attestation +) target_link_libraries(tfm_psa_rot_partition_attestation PRIVATE diff --git a/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt b/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt index 2eb984e125..df8a9e847b 100644 --- a/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt +++ b/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt @@ -22,6 +22,10 @@ target_include_directories(tfm_psa_rot_partition_its # Required for ps_object_defs.h $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/../protected_storage ) +target_include_directories(tfm_partitions + INTERFACE + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage +) target_sources(tfm_psa_rot_partition_its PRIVATE @@ -43,6 +47,11 @@ target_sources(tfm_psa_rot_partition_its $<$<BOOL:${TFM_PSA_API}>: ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage/auto_generated/intermedia_tfm_internal_trusted_storage.c> ) +target_sources(tfm_partitions + INTERFACE + $<$<BOOL:${TFM_PSA_API}>: + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage/auto_generated/static_info_tfm_internal_trusted_storage.c> +) target_link_libraries(tfm_psa_rot_partition_its PRIVATE diff --git a/secure_fw/partitions/ns_proxy_partition/CMakeLists.txt b/secure_fw/partitions/ns_proxy_partition/CMakeLists.txt new file mode 100644 index 0000000000..e08525ebe3 --- /dev/null +++ b/secure_fw/partitions/ns_proxy_partition/CMakeLists.txt @@ -0,0 +1,14 @@ +#------------------------------------------------------------------------------- +# Copyright (c) 2021, Arm Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# +#------------------------------------------------------------------------------- + +cmake_minimum_required(VERSION 3.15) +cmake_policy(SET CMP0079 NEW) + +target_sources(tfm_partitions + INTERFACE + $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/static_info_ns_proxy.c> +) diff --git a/secure_fw/partitions/ns_proxy_partition/static_info_ns_proxy.c b/secure_fw/partitions/ns_proxy_partition/static_info_ns_proxy.c new file mode 100644 index 0000000000..700a86ba15 --- /dev/null +++ b/secure_fw/partitions/ns_proxy_partition/static_info_ns_proxy.c @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2021, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +/***** WARNING: This file SHOULD BE CHANGED according to storage template *****/ + +#include <stdint.h> +#include <stddef.h> +#include "region.h" +#include "region_defs.h" +#include "spm_partition_defs.h" +#include "load/partition_static_load.h" +#include "load/partition_defs.h" +#include "load/service_defs.h" +#include "psa_manifest/pid.h" +#include "psa_manifest/sid.h" + +#define TFM_SP_NS_PROXY_NDEPS (0) +#define TFM_SP_NS_PROXY_NSERVS (0) + +/* Memory region declaration */ +REGION_DECLARE(Image$$, ARM_LIB_STACK, $$ZI$$Base); +REGION_DECLARE(Image$$, ARM_LIB_STACK, $$ZI$$Limit); + +/* Entrypoint function declaration */ +extern void tfm_nspm_thread_entry(void); + +struct partition_tfm_sp_ns_proxy_static_info_t { + /* common length data */ + struct partition_static_info_t cmn_info; + /* per-partition variable length data */ + uintptr_t stack_pos; + uintptr_t heap_pos; +} __attribute__((aligned(4))); + +/* Partition static, deps, service static data. Put to a dedicated section. */ +const struct partition_tfm_sp_ns_proxy_static_info_t + tfm_sp_ns_proxy_static __attribute__((used, section(".partition_info"))) = { + .cmn_info = { + .psa_ff_ver = 0x0100 | PARTITION_INFO_MAGIC, + .pid = TFM_SP_NON_SECURE_ID, + .flags = PARTITION_PRI_LOWEST | SPM_PART_FLAG_IPC +#if TFM_MULTI_CORE_TOPOLOGY + | SPM_PART_FLAG_PSA_ROT +#endif + , + .entry = ENTRY_TO_POSITION(tfm_nspm_thread_entry), + .stack_size = S_PSP_STACK_SIZE, + .heap_size = 0, + .ndeps = TFM_SP_NS_PROXY_NDEPS, + .nservices = TFM_SP_NS_PROXY_NSERVS, + .plat_cookie = 0, +#if TFM_LVL == 3 + .mems = { + .start = PART_REGION_ADDR(ARM_LIB_STACK, $$ZI$$Base), + .limit = PART_REGION_ADDR(ARM_LIB_STACK, $$ZI$$Limit), + }, +#endif + }, + .stack_pos = PART_REGION_ADDR(ARM_LIB_STACK, $$ZI$$Base), + .heap_pos = 0, +}; diff --git a/secure_fw/partitions/partition_static_info.template b/secure_fw/partitions/partition_static_info.template new file mode 100644 index 0000000000..e3a3a2b1f3 --- /dev/null +++ b/secure_fw/partitions/partition_static_info.template @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2021, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +{{utilities.donotedit_warning}} + +#include <stdint.h> +#include <stddef.h> +#include "region.h" +#include "load/partition_static_load.h" +#include "load/partition_defs.h" +#include "load/service_defs.h" +#include "tfm_peripherals_def.h" +#include "psa_manifest/pid.h" +#include "psa_manifest/sid.h" +#include "psa_manifest/{{file_name}}.h" + +{% set counter = namespace(dep_counter=0, service_counter=0) %} +{% if manifest.dependencies %} + {% for dep in manifest.dependencies %} + {% set counter.dep_counter = counter.dep_counter + 1 %} + {% endfor %} +{% endif %} +{% if manifest.services %} + {% for service in manifest.services %} + {% set counter.service_counter = counter.service_counter + 1 %} + {% endfor %} +{% endif %} +#define {{"%-55s"|format(manifest.name|upper + "_NDEPS")}} ({{"%d"|format(counter.dep_counter)}}) +#define {{"%-55s"|format(manifest.name|upper + "_NSERVS")}} ({{"%d"|format(counter.service_counter)}}) + +/* Memory region declaration */ +#if TFM_LVL == 3 +REGION_DECLARE(Image$$, PT_{{manifest.name}}_PRIVATE, _DATA_START$$Base); +REGION_DECLARE(Image$$, PT_{{manifest.name}}_PRIVATE, _DATA_END$$Base); +#endif +extern uint8_t {{manifest.name|lower}}_stack[]; + +/* Entrypoint function declaration */ +extern void {{manifest.entry_point}}(void); + +{% if manifest.mmio_regions %} +/* Platform data declaration */ +const struct platform_data_t *platform_data_list_{{manifest.name|lower}}[] = +{ + {% for region in manifest.mmio_regions %} + {% if region.conditional %} +#ifdef {{region.conditional}} + {% endif %} + {{region.name}}, + {% if region.conditional %} +#endif + {% endif %} + {% endfor %} + NULL +}; +{% endif %} + +/* partition static info type definition */ +struct partition_{{manifest.name|lower}}_static_info_t { + /* common length data */ + struct partition_static_info_t cmn_info; + /* per-partition variable length data */ + uintptr_t stack_pos; + uintptr_t heap_pos; +{% if manifest.dependencies %} + uint32_t deps[{{(manifest.name|upper + "_NDEPS")}}]; +{% endif %} +{% if manifest.services %} + struct service_static_info_t services[{{(manifest.name|upper + "_NSERVS")}}]; +{% endif %} +} __attribute__((aligned(4))); + +/* Partition static, deps, service static data. Put to a dedicated section. */ +const struct partition_{{manifest.name|lower}}_static_info_t {{manifest.name|lower}}_static + __attribute__((used, section(".partition_info"))) = { + .cmn_info = { +{% if manifest.psa_framework_version == 1.0 %} + .psa_ff_ver = 0x0100 | PARTITION_INFO_MAGIC, +{% elif manifest.psa_framework_version == 1.1 %} + .psa_ff_ver = 0x0101 | PARTITION_INFO_MAGIC, +{% else %} +#error "Unsupported ff version '{{manifest.psa_framework_version}}' for partition '{{manifest.name}}'!" +{% endif %} + .pid = {{manifest.name}}, + .flags = 0 +{% if manifest.psa_framework_version == 1.0 and attr.tfm_partition_ipc is sameas true %} + | SPM_PART_FLAG_IPC +{% elif manifest.psa_framework_version == 1.1 and manifest.model == "IPC" %} + | SPM_PART_FLAG_IPC +{% endif %} +{% if manifest.type == "PSA-ROT" %} + | SPM_PART_FLAG_PSA_ROT +{% elif manifest.type != "APPLICATION-ROT" %} +#error "Unsupported type '{{manifest.type}}' for partition '{{manifest.name}}'!" +{% endif %} + | PARTITION_PRI_{{manifest.priority}}, + .entry = ENTRY_TO_POSITION({{manifest.entry_point}}), + .stack_size = {{manifest.stack_size}}, + .heap_size = 0, + .ndeps = {{(manifest.name|upper + "_NDEPS")}}, + .nservices = {{(manifest.name|upper + "_NSERVS")}}, +{% if manifest.mmio_regions %} + .plat_cookie = PTR_TO_POSITION(platform_data_list_{{manifest.name|lower}}), +{% else %} + .plat_cookie = 0, +{% endif %} +#if TFM_LVL == 3 + .mems = { + .start = PART_REGION_ADDR(PT_{{manifest.name}}_PRIVATE, _DATA_START$$Base), + .limit = PART_REGION_ADDR(PT_{{manifest.name}}_PRIVATE, _DATA_END$$Base), + }, +#endif + }, + .stack_pos = PTR_TO_POSITION({{manifest.name|lower}}_stack), + .heap_pos = 0, +{% if manifest.dependencies %} + .deps = { + {% for dep in manifest.dependencies %} + {{dep}}_SID, + {% endfor %} + }, +{% endif %} +{% if manifest.services %} + .services = { + {% for service in manifest.services %} + { + .name_strid = STRING_PTR_TO_STRID("{{service.name}}"), + .signal = {{service.name}}_SIGNAL, + .sid = {{service.sid}}, + .flags = 0 + {% if service.non_secure_clients is sameas true %} + | SERVICE_FLAG_NS_ACCESSIBLE + {% endif %} + {% if manifest.psa_framework_version > 1.0 and service.connection_based is sameas false %} + | SERVICE_FLAG_STATELESS + {% endif %} + {% if service.version_policy %} + | TFM_VERSION_POLICY_{{service.version_policy}}, + {% else %} + | TFM_VERSION_POLICY_STRICT, + {% endif %} + {% if service.version %} + .version = {{service.version}}, + {% else %} + .version = 1, + {% endif %} + }, + {% endfor %} + }, +{% endif %} +}; diff --git a/secure_fw/partitions/platform/CMakeLists.txt b/secure_fw/partitions/platform/CMakeLists.txt index aac7366845..e52d44e013 100644 --- a/secure_fw/partitions/platform/CMakeLists.txt +++ b/secure_fw/partitions/platform/CMakeLists.txt @@ -22,12 +22,22 @@ target_sources(tfm_psa_rot_partition_platform $<$<BOOL:${TFM_PSA_API}>: ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/platform/auto_generated/intermedia_tfm_platform.c> ) +target_sources(tfm_partitions + INTERFACE + $<$<BOOL:${TFM_PSA_API}>: + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/platform/auto_generated/static_info_tfm_platform.c> +) +# Set include directory target_include_directories(tfm_psa_rot_partition_platform PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/platform ) +target_include_directories(tfm_partitions + INTERFACE + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/platform +) target_link_libraries(tfm_psa_rot_partition_platform PRIVATE diff --git a/secure_fw/partitions/protected_storage/CMakeLists.txt b/secure_fw/partitions/protected_storage/CMakeLists.txt index fa1c33a1e3..7f2366a333 100644 --- a/secure_fw/partitions/protected_storage/CMakeLists.txt +++ b/secure_fw/partitions/protected_storage/CMakeLists.txt @@ -28,6 +28,10 @@ target_include_directories(tfm_app_rot_partition_ps PRIVATE ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/protected_storage ) +target_include_directories(tfm_partitions + INTERFACE + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/protected_storage +) target_sources(tfm_app_rot_partition_ps PRIVATE @@ -49,6 +53,11 @@ target_sources(tfm_app_rot_partition_ps $<$<BOOL:${TFM_PSA_API}>: ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/protected_storage/auto_generated/intermedia_tfm_protected_storage.c> ) +target_sources(tfm_partitions + INTERFACE + $<$<BOOL:${TFM_PSA_API}>: + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/protected_storage/auto_generated/static_info_tfm_protected_storage.c> +) target_link_libraries(tfm_app_rot_partition_ps PRIVATE diff --git a/secure_fw/partitions/psa_proxy/CMakeLists.txt b/secure_fw/partitions/psa_proxy/CMakeLists.txt index 5db47e9b13..2a515df541 100644 --- a/secure_fw/partitions/psa_proxy/CMakeLists.txt +++ b/secure_fw/partitions/psa_proxy/CMakeLists.txt @@ -14,6 +14,7 @@ cmake_policy(SET CMP0079 NEW) add_library(tfm_psa_rot_partition_psa_proxy STATIC) +# Set include directory target_include_directories(tfm_psa_rot_partition_psa_proxy INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> @@ -22,6 +23,10 @@ target_include_directories(tfm_psa_rot_partition_psa_proxy # Required for spm_ipc.h $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/../../spm/cmsis_psa ) +target_include_directories(tfm_partitions + INTERFACE + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/psa_proxy +) target_sources(tfm_psa_rot_partition_psa_proxy PRIVATE @@ -35,6 +40,10 @@ target_sources(tfm_psa_rot_partition_psa_proxy PRIVATE ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/psa_proxy/auto_generated/intermedia_tfm_psa_proxy.c ) +target_sources(tfm_partitions + INTERFACE + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/psa_proxy/auto_generated/static_info_tfm_psa_proxy.c +) target_link_libraries(tfm_psa_rot_partition_psa_proxy PRIVATE diff --git a/secure_fw/partitions/tfm_ffm11_partition/CMakeLists.txt b/secure_fw/partitions/tfm_ffm11_partition/CMakeLists.txt index 2d3ba76c7b..6c5d6a74d2 100644 --- a/secure_fw/partitions/tfm_ffm11_partition/CMakeLists.txt +++ b/secure_fw/partitions/tfm_ffm11_partition/CMakeLists.txt @@ -24,12 +24,22 @@ target_sources(tfm_app_rot_partition_ffm11 PRIVATE ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/tfm_ffm11_partition/auto_generated/intermedia_tfm_ffm11_partition.c ) +target_sources(tfm_partitions + INTERFACE + $<$<BOOL:${TFM_PSA_API}>: + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/tfm_ffm11_partition/auto_generated/static_info_tfm_ffm11_partition.c> +) +# Set include directory target_include_directories(tfm_app_rot_partition_ffm11 PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/tfm_ffm11_partition ) +target_include_directories(tfm_partitions + INTERFACE + ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/tfm_ffm11_partition +) target_link_libraries(tfm_app_rot_partition_ffm11 PRIVATE diff --git a/tools/tfm_parse_manifest_list.py b/tools/tfm_parse_manifest_list.py index 1aea3cec17..68b5979425 100644 --- a/tools/tfm_parse_manifest_list.py +++ b/tools/tfm_parse_manifest_list.py @@ -75,6 +75,7 @@ def process_manifest(manifest_list_files): manifesttemplate = ENV.get_template('secure_fw/partitions/manifestfilename.template') memorytemplate = ENV.get_template('secure_fw/partitions/partition_intermedia.template') + infotemplate = ENV.get_template('secure_fw/partitions/partition_static_info.template') pid_list = [] no_pid_manifest_idx = [] @@ -115,6 +116,7 @@ def process_manifest(manifest_list_files): context['file_name'] = outfile_name.replace('.h', '') outfile_name = os.path.join(manifest_dir, "psa_manifest", outfile_name).replace('\\', '/') intermediafile_name = os.path.join(manifest_dir, "auto_generated", 'intermedia_' + context['file_name'] + '.c').replace('\\', '/') + infofile_name = os.path.join(manifest_dir, "auto_generated", 'static_info_' + context['file_name'] + '.c').replace('\\', '/') """ Remove the `source_path` portion of the filepaths, so that it can be @@ -125,12 +127,14 @@ def process_manifest(manifest_list_files): source_path = os.path.expandvars(manifest_item['source_path']) outfile_name = os.path.relpath(outfile_name, start = source_path) intermediafile_name = os.path.relpath(intermediafile_name, start = source_path) + infofile_name = os.path.relpath(infofile_name, start = source_path) partition_db.append({"manifest": manifest, "attr": manifest_item, "header_file": outfile_name}) if OUT_DIR is not None: outfile_name = os.path.join(OUT_DIR, outfile_name) intermediafile_name = os.path.join(OUT_DIR, intermediafile_name) + infofile_name = os.path.join(OUT_DIR, infofile_name) outfile_path = os.path.dirname(outfile_name) if not os.path.exists(outfile_path): @@ -152,6 +156,16 @@ def process_manifest(manifest_list_files): memoutfile.write(memorytemplate.render(context)) memoutfile.close() + infofile_path = os.path.dirname(infofile_name) + if not os.path.exists(infofile_path): + os.makedirs(infofile_path) + + print ("Generating " + infofile_name) + + info_outfile = io.open(infofile_name, "w", newline=None) + info_outfile.write(infotemplate.render(context)) + info_outfile.close() + return partition_db def gen_files(context, gen_file_lists): |