[REDO]: Pass build configurations through header file
This patch re-applies 56979ee5579dbb90bbf598af4c252259e5f20777
as it was reverted.
The CI failure was because the patch that triggered CI was not
rebased for dependency changes between TF-M and TF-M test repo.
Change-Id: I7f96e285c2659ef39731e8736bd641895413818a
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/lib/ext/tf-m-tests/repo_config_default.cmake b/lib/ext/tf-m-tests/repo_config_default.cmake
index 90dce1b..c3a9d82 100644
--- a/lib/ext/tf-m-tests/repo_config_default.cmake
+++ b/lib/ext/tf-m-tests/repo_config_default.cmake
@@ -8,5 +8,5 @@
# Default configs of tf-m-tests repo
set(TFM_TEST_REPO_PATH "DOWNLOAD" CACHE PATH "Path to TFM-TEST repo (or DOWNLOAD to fetch automatically")
-set(TFM_TEST_REPO_VERSION "2d69f5a" CACHE STRING "The version of tf-m-tests to use")
+set(TFM_TEST_REPO_VERSION "3e6c52b" CACHE STRING "The version of tf-m-tests to use")
set(CMSIS_5_PATH "DOWNLOAD" CACHE PATH "Path to CMSIS_5 (or DOWNLOAD to fetch automatically")
diff --git a/platform/ext/target/arm/rss/config.cmake b/platform/ext/target/arm/rss/config.cmake
index c5e4276..5a3744a 100644
--- a/platform/ext/target/arm/rss/config.cmake
+++ b/platform/ext/target/arm/rss/config.cmake
@@ -32,10 +32,12 @@
set(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE OFF CACHE BOOL "Enable Internal Trusted Storage partition")
set(TFM_PARTITION_MEASURED_BOOT ON CACHE BOOL "Enable Measured boot partition")
set(MEASURED_BOOT_HASH_ALG PSA_ALG_SHA_256 CACHE STRING "Hash algorithm used by Measured boot services")
-set(TFM_MANIFEST_LIST ${CMAKE_CURRENT_LIST_DIR}/manifest/tfm_manifest_list.yaml CACHE FILEPATH "TF-M native Secure Partition manifests list file")
set(TFM_MBEDCRYPTO_PLATFORM_EXTRA_CONFIG_PATH ${CMAKE_CURRENT_LIST_DIR}/mbedtls_extra_config.h CACHE PATH "Config to append to standard Mbed Crypto config, used by platforms to cnfigure feature support")
set(CONFIG_TFM_USE_TRUSTZONE OFF CACHE BOOL "Enable use of TrustZone to transition between NSPE and SPE")
set(TFM_MULTI_CORE_TOPOLOGY ON CACHE BOOL "Whether to build for a dual-cpu architecture")
set(TFM_PLAT_SPECIFIC_MULTI_CORE_COMM ON CACHE BOOL "Whether to use a platform specific inter-core communication instead of mailbox in dual-cpu topology")
set(TEST_NS_MULTI_CORE OFF CACHE BOOL "Whether to build NS regression multi-core tests")
+
+configure_file(${CMAKE_CURRENT_LIST_DIR}/manifest/tfm_manifest_list.yaml ${CMAKE_BINARY_DIR}/tools/tfm_manifest_list.yaml)
+set(TFM_MANIFEST_LIST ${CMAKE_BINARY_DIR}/tools/tfm_manifest_list.yaml CACHE FILEPATH "TF-M native Secure Partition manifests list file")
diff --git a/platform/ext/target/arm/rss/manifest/tfm_manifest_list.yaml b/platform/ext/target/arm/rss/manifest/tfm_manifest_list.yaml
index 28aafd2..827f1bb 100644
--- a/platform/ext/target/arm/rss/manifest/tfm_manifest_list.yaml
+++ b/platform/ext/target/arm/rss/manifest/tfm_manifest_list.yaml
@@ -26,7 +26,7 @@
"short_name": "TFM_NS_AGENT_MAILBOX",
"manifest": "${CMAKE_SOURCE_DIR}/secure_fw/partitions/ns_agent_mailbox/ns_agent_mailbox.yaml",
"output_path": "secure_fw/partitions/ns_agent_mailbox",
- "conditional": "@TFM_MULTI_CORE_TOPOLOGY@",
+ "conditional": "TFM_MULTI_CORE_TOPOLOGY",
"version_major": 0,
"version_minor": 1,
"pid": 0,
@@ -41,7 +41,7 @@
"short_name": "TFM_SP_CRYPTO",
"manifest": "${CMAKE_SOURCE_DIR}/platform/ext/target/arm/rss/manifest/tfm_crypto.yaml",
"output_path": "secure_fw/partitions/crypto",
- "conditional": "@TFM_PARTITION_CRYPTO@",
+ "conditional": "TFM_PARTITION_CRYPTO",
"version_major": 0,
"version_minor": 1,
"pid": 259,
@@ -56,7 +56,7 @@
"short_name": "TFM_SP_PLATFORM",
"manifest": "${CMAKE_SOURCE_DIR}/secure_fw/partitions/platform/tfm_platform.yaml",
"output_path": "secure_fw/partitions/platform",
- "conditional": "@TFM_PARTITION_PLATFORM@",
+ "conditional": "TFM_PARTITION_PLATFORM",
"version_major": 0,
"version_minor": 1,
"pid": 260,
@@ -71,7 +71,7 @@
"short_name": "TFM_SP_INITIAL_ATTESTATION",
"manifest": "${CMAKE_SOURCE_DIR}/secure_fw/partitions/initial_attestation/tfm_initial_attestation.yaml",
"output_path": "secure_fw/partitions/initial_attestation",
- "conditional": "@TFM_PARTITION_INITIAL_ATTESTATION@",
+ "conditional": "TFM_PARTITION_INITIAL_ATTESTATION",
"version_major": 0,
"version_minor": 1,
"pid": 261,
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index d4edc1c..03ab243 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -8,62 +8,31 @@
cmake_minimum_required(VERSION 3.15)
find_package(Python3)
-############################### Manifest declaration ###########################
-
-list(APPEND TEMP_MANIFEST_LISTS ${TFM_MANIFEST_LIST})
+############################### Manifest lists declaration #####################
+list(APPEND MANIFEST_LISTS ${TFM_MANIFEST_LIST})
if (TFM_NS_REG_TEST OR TFM_S_REG_TEST)
- list(APPEND TEMP_MANIFEST_LISTS ${TFM_TEST_PATH}/secure_fw/tfm_test_manifest_list.yaml)
+ list(APPEND MANIFEST_LISTS ${TFM_TEST_PATH}/secure_fw/tfm_test_manifest_list.yaml)
endif()
if ("${TEST_PSA_API}" STREQUAL "IPC")
- list(APPEND TEMP_MANIFEST_LISTS ${CMAKE_CURRENT_SOURCE_DIR}/tfm_psa_ff_test_manifest_list.yaml)
+ # The manifest tool does not recognize CMake varibles. Do configure_file() first.
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tfm_psa_ff_test_manifest_list.yaml
+ ${CMAKE_CURRENT_BINARY_DIR}/tfm_psa_ff_test_manifest_list.yaml)
+ list(APPEND MANIFEST_LISTS ${CMAKE_CURRENT_BINARY_DIR}/tfm_psa_ff_test_manifest_list.yaml)
endif()
if (TFM_EXTRA_MANIFEST_LIST_FILES)
- list(APPEND TEMP_MANIFEST_LISTS ${TFM_EXTRA_MANIFEST_LIST_FILES})
+ list(APPEND MANIFEST_LISTS ${TFM_EXTRA_MANIFEST_LIST_FILES})
endif()
-# Build up the manifest list arrays:
-# - CONFIGURED_MANIFEST_LISTS:
-# Array of Manifest lists under build directory which are the output of configure_file().
-# - MANIFEST_LIST_PATHS:
-# Array of paths of the input manifest lists of configure_file().
-# They are NOT the paths of CONFIGURED_MANIFEST_LISTS.
-# They can be used to build up manifest file paths if manifest file paths are
-# relative ones in the manifest lists.
-# - COMBINED_LIST:
-# A combined list of the above two, with the following format:
-# [configured_list_a, path_of_list_a, configured_list_b, path_of_list_b ... ]
-set(POSTFIX 1)
-
-foreach(MANIFEST_LIST IN LISTS TEMP_MANIFEST_LISTS)
- if (NOT EXISTS ${MANIFEST_LIST})
- message(FATAL_ERROR "Manifest list ${MANIFEST_LIST} doesn't exist")
- endif()
-
- get_filename_component(MANIFEST_LIST_NAME ${MANIFEST_LIST} NAME_WLE)
- set(CONFIGURED_LIST
- ${CMAKE_CURRENT_BINARY_DIR}/${MANIFEST_LIST_NAME}_${POSTFIX}.yaml)
-
- configure_file(${MANIFEST_LIST} ${CONFIGURED_LIST})
- list(APPEND CONFIGURED_MANIFEST_LISTS ${CONFIGURED_LIST})
- list(APPEND COMBINED_LIST ${CONFIGURED_LIST})
-
- get_filename_component(MANIFEST_LIST_PATH ${MANIFEST_LIST} DIRECTORY)
- list(APPEND MANIFEST_LIST_PATHS ${MANIFEST_LIST_PATH})
- list(APPEND COMBINED_LIST ${MANIFEST_LIST_PATH})
-
- math(EXPR POSTFIX "${POSTFIX} + 1")
-endforeach()
-
############################### File list declaration ##########################
-
set(GENERATED_FILE_LISTS ${CMAKE_CURRENT_SOURCE_DIR}/tfm_generated_file_list.yaml)
set(GENERATED_FILE_LISTS ${GENERATED_FILE_LISTS} ${TFM_EXTRA_GENERATED_FILE_LIST_PATH})
-############################### Dependency generation ##########################
-
+############################### Functions declaration ##########################
+# Parses the given YAML "files" to find out all the items of the given "field"
+# and put them to the "output_variable" as a list.
function(parse_field_from_yaml files field output_variable)
set(local_variable "")
foreach(yaml_file ${files})
@@ -80,6 +49,28 @@
set(${output_variable} ${local_variable} PARENT_SCOPE)
endfunction()
+############################### Dependency generation ##########################
+# Get all the manifest files from manifest lists
+foreach(MANIFEST_LIST ${MANIFEST_LISTS})
+ if (NOT EXISTS ${MANIFEST_LIST})
+ message(FATAL_ERROR "Manifest list ${MANIFEST_LIST} doesn't exist")
+ endif()
+
+ # Get the path of the manifest list
+ get_filename_component(MANIFEST_LIST_PATH ${MANIFEST_LIST} DIRECTORY)
+
+ # Get all the "manifest"
+ parse_field_from_yaml(${MANIFEST_LIST} manifest MANIFESTS)
+
+ foreach(MANIFEST ${MANIFESTS})
+ # Convert to absolute paths
+ if (NOT IS_ABSOLUTE ${MANIFEST})
+ get_filename_component(MANIFEST "${MANIFEST_LIST_PATH}/${MANIFEST}" ABSOLUTE)
+ endif()
+ list(APPEND MANIFEST_FILES ${MANIFEST})
+ endforeach()
+endforeach()
+
parse_field_from_yaml("${GENERATED_FILE_LISTS}" template TEMPLATE_FILES)
# Replace relative paths with absolute paths
# Paths used in GENERATED_FILE_LISTS are all relative to TF-M root (${CMAKE_SOURCE_DIR})
@@ -90,25 +81,32 @@
# Paths used in GENERATED_FILE_LISTS are all relative to TF-M root (${CMAKE_SOURCE_DIR})
list(TRANSFORM OUTPUT_FILES REPLACE "^([^/\\][^:].*)" "${CMAKE_BINARY_DIR}/generated/\\1")
-# Each manifest list may have different original path
-# Parse them one by one
-set(INDEX 0)
-foreach(CONFIGURED_LIST ${CONFIGURED_MANIFEST_LISTS})
- list(GET MANIFEST_LIST_PATHS ${INDEX} PATH_OF_LIST)
+############################### Generate Manifest config header ################
+parse_field_from_yaml("${MANIFEST_LISTS}" conditional CONDITIONS)
- parse_field_from_yaml(${CONFIGURED_LIST} manifest MANIFESTS)
- foreach(MANIFEST ${MANIFESTS})
- # The path of each manifest must be absolute path or relative path to
- # the path of manifest list that holds it
- if (NOT IS_ABSOLUTE ${MANIFEST})
- set(MANIFEST "${PATH_OF_LIST}/${MANIFEST}")
- endif()
- list(APPEND MANIFEST_FILES ${MANIFEST})
- endforeach()
+# Isolation level and backend are required by the manifest tool
+string(APPEND MANIFEST_CONFIG_H_CONTENT
+ "#cmakedefine TFM_ISOLATION_LEVEL @TFM_ISOLATION_LEVEL@\r\n")
+string(APPEND MANIFEST_CONFIG_H_CONTENT
+ "#cmakedefine CONFIG_TFM_SPM_BACKEND @CONFIG_TFM_SPM_BACKEND@\r\n")
- math(EXPR INDEX "${INDEX} + 1")
+foreach(CON ${CONDITIONS})
+ # Secure Partitions may share the same conditions, perform duplication check here
+ string(FIND ${MANIFEST_CONFIG_H_CONTENT} ${CON} CON_EXISTS)
+ if (${CON_EXISTS} EQUAL -1) # Not found
+ string(APPEND MANIFEST_CONFIG_H_CONTENT
+ "#cmakedefine01 ${CON}\r\n")
+ endif()
endforeach()
+# Generate the config header
+file(WRITE
+ ${CMAKE_CURRENT_BINARY_DIR}/manifest_config.h.in
+ ${MANIFEST_CONFIG_H_CONTENT})
+
+configure_file(${CMAKE_CURRENT_BINARY_DIR}/manifest_config.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/manifest_config.h)
+
############################### Command declaration ############################
# Workaround for heap support
@@ -131,17 +129,16 @@
set(MANIFEST_COMMAND
${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tfm_parse_manifest_list.py
- -m ${COMBINED_LIST}
+ -m ${MANIFEST_LISTS}
-f ${GENERATED_FILE_LISTS}
- -l ${TFM_ISOLATION_LEVEL}
- -b ${CONFIG_TFM_SPM_BACKEND}
+ -c ${CMAKE_CURRENT_BINARY_DIR}/manifest_config.h
-o ${CMAKE_BINARY_DIR}/generated
${PARSE_MANIFEST_QUIET_FLAG})
add_custom_command(OUTPUT ${OUTPUT_FILES}
COMMAND ${MANIFEST_COMMAND}
DEPENDS ${TEMPLATE_FILES} ${MANIFEST_FILES}
- DEPENDS ${TEMP_MANIFEST_LISTS} ${CONFIGURED_MANIFEST_LISTS} ${GENERATED_FILE_LISTS}
+ DEPENDS ${MANIFEST_LISTS} ${GENERATED_FILE_LISTS}
)
# The files need to be generated before cmake will allow them to be used as
@@ -155,5 +152,5 @@
if(RET EQUAL 0)
include(${CMAKE_BINARY_DIR}/generated/tools/config_impl.cmake)
else()
- message(FATAL_ERROR "File generation failed")
+ message(FATAL_ERROR "Manifest tool failed to generate files!")
endif()
diff --git a/tools/tfm_manifest_list.yaml b/tools/tfm_manifest_list.yaml
index 10cc730..880ae17 100644
--- a/tools/tfm_manifest_list.yaml
+++ b/tools/tfm_manifest_list.yaml
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2021, Arm Limited. All rights reserved.
+# Copyright (c) 2018-2022, Arm Limited. All rights reserved.
# Copyright (c) 2021-2022 Cypress Semiconductor Corporation (an Infineon company)
# or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
#
@@ -25,9 +25,9 @@
{
"name": "Non-Secure Mailbox Agent",
"short_name": "TFM_NS_AGENT_MAILBOX",
- "manifest": "${CMAKE_SOURCE_DIR}/secure_fw/partitions/ns_agent_mailbox/ns_agent_mailbox.yaml",
+ "manifest": "../secure_fw/partitions/ns_agent_mailbox/ns_agent_mailbox.yaml",
"output_path": "secure_fw/partitions/ns_agent_mailbox",
- "conditional": "@TFM_PARTITION_NS_AGENT_MAILBOX@",
+ "conditional": "TFM_PARTITION_NS_AGENT_MAILBOX",
"version_major": 0,
"version_minor": 1,
"pid": 0,
@@ -40,9 +40,9 @@
{
"name": "Protected Storage Service",
"short_name": "TFM_SP_PS",
- "manifest": "${CMAKE_SOURCE_DIR}/secure_fw/partitions/protected_storage/tfm_protected_storage.yaml",
+ "manifest": "../secure_fw/partitions/protected_storage/tfm_protected_storage.yaml",
"output_path": "secure_fw/partitions/protected_storage",
- "conditional": "@TFM_PARTITION_PROTECTED_STORAGE@",
+ "conditional": "TFM_PARTITION_PROTECTED_STORAGE",
"version_major": 0,
"version_minor": 1,
"pid": 256,
@@ -55,9 +55,9 @@
{
"name": "TF-M Internal Trusted Storage Service",
"short_name": "TFM_SP_ITS",
- "manifest": "${CMAKE_SOURCE_DIR}/secure_fw/partitions/internal_trusted_storage/tfm_internal_trusted_storage.yaml",
+ "manifest": "../secure_fw/partitions/internal_trusted_storage/tfm_internal_trusted_storage.yaml",
"output_path": "secure_fw/partitions/internal_trusted_storage",
- "conditional": "@TFM_PARTITION_INTERNAL_TRUSTED_STORAGE@",
+ "conditional": "TFM_PARTITION_INTERNAL_TRUSTED_STORAGE",
"version_major": 0,
"version_minor": 1,
"pid": 257,
@@ -70,9 +70,9 @@
{
"name": "TFM Audit Log Service",
"short_name": "TFM_SP_AUDIT_LOG",
- "manifest": "${CMAKE_SOURCE_DIR}/secure_fw/partitions/audit_logging/tfm_audit_logging.yaml",
+ "manifest": "../secure_fw/partitions/audit_logging/tfm_audit_logging.yaml",
"output_path": "secure_fw/partitions/audit_logging",
- "conditional": "@TFM_PARTITION_AUDIT_LOG@",
+ "conditional": "TFM_PARTITION_AUDIT_LOG",
"version_major": 0,
"version_minor": 1,
"pid": 255,
@@ -85,9 +85,9 @@
{
"name": "TFM Crypto Service",
"short_name": "TFM_SP_CRYPTO",
- "manifest": "${CMAKE_SOURCE_DIR}/secure_fw/partitions/crypto/tfm_crypto.yaml",
+ "manifest": "../secure_fw/partitions/crypto/tfm_crypto.yaml",
"output_path": "secure_fw/partitions/crypto",
- "conditional": "@TFM_PARTITION_CRYPTO@",
+ "conditional": "TFM_PARTITION_CRYPTO",
"version_major": 0,
"version_minor": 1,
"pid": 259,
@@ -100,9 +100,9 @@
{
"name": "TFM Platform Service",
"short_name": "TFM_SP_PLATFORM",
- "manifest": "${CMAKE_SOURCE_DIR}/secure_fw/partitions/platform/tfm_platform.yaml",
+ "manifest": "../secure_fw/partitions/platform/tfm_platform.yaml",
"output_path": "secure_fw/partitions/platform",
- "conditional": "@TFM_PARTITION_PLATFORM@",
+ "conditional": "TFM_PARTITION_PLATFORM",
"version_major": 0,
"version_minor": 1,
"pid": 260,
@@ -115,9 +115,9 @@
{
"name": "TFM Initial Attestation Service",
"short_name": "TFM_SP_INITIAL_ATTESTATION",
- "manifest": "${CMAKE_SOURCE_DIR}/secure_fw/partitions/initial_attestation/tfm_initial_attestation.yaml",
+ "manifest": "../secure_fw/partitions/initial_attestation/tfm_initial_attestation.yaml",
"output_path": "secure_fw/partitions/initial_attestation",
- "conditional": "@TFM_PARTITION_INITIAL_ATTESTATION@",
+ "conditional": "TFM_PARTITION_INITIAL_ATTESTATION",
"version_major": 0,
"version_minor": 1,
"pid": 261,
@@ -130,10 +130,10 @@
{
"name": "TF-M PSA Proxy Service",
"short_name": "TFM_SP_PSA_PROXY",
- "manifest": "${CMAKE_SOURCE_DIR}/secure_fw/partitions/psa_proxy/tfm_psa_proxy.yaml",
+ "manifest": "../secure_fw/partitions/psa_proxy/tfm_psa_proxy.yaml",
"output_path": "secure_fw/partitions/psa_proxy",
"tfm_extensions": true,
- "conditional": "@TFM_PARTITION_PSA_PROXY@",
+ "conditional": "TFM_PARTITION_PSA_PROXY",
"version_major": 0,
"version_minor": 1,
"pid": 270,
@@ -146,9 +146,9 @@
{
"name": "TFM Firmware Update Service",
"short_name": "TFM_SP_FWU",
- "manifest": "${CMAKE_SOURCE_DIR}/secure_fw/partitions/firmware_update/tfm_firmware_update.yaml",
+ "manifest": "../secure_fw/partitions/firmware_update/tfm_firmware_update.yaml",
"output_path": "secure_fw/partitions/firmware_update",
- "conditional": "@TFM_PARTITION_FIRMWARE_UPDATE@",
+ "conditional": "TFM_PARTITION_FIRMWARE_UPDATE",
"version_major": 0,
"version_minor": 1,
"pid": 271,
diff --git a/tools/tfm_parse_manifest_list.py b/tools/tfm_parse_manifest_list.py
index 5cc25ce..3f76a85 100644
--- a/tools/tfm_parse_manifest_list.py
+++ b/tools/tfm_parse_manifest_list.py
@@ -88,6 +88,37 @@
return macro_def
+def parse_configurations(file_paths):
+ """
+ Parses the given config files and return a dict whose key-values are build
+ configurations and their values.
+
+ Valid configurations should be in the format of:
+ "#define VAR [...]" in a single line.
+ The value of the config is optional.
+ """
+ configurations = {}
+
+ lines = []
+ for file in file_paths:
+ with open(file, 'r') as config_file:
+ lines += config_file.readlines()
+
+ for line in lines:
+ if not line.startswith('#define'):
+ continue
+
+ line = line.rstrip('\r\n')
+ line_items = line.split(maxsplit=2)
+ if len(line_items) == 3:
+ configurations[line_items[1]] = line_items[2]
+ elif len(line_items) == 2:
+ configurations[line_items[1]] = ''
+
+ logging.debug(configurations)
+
+ return configurations
+
def manifest_validation(manifest, pid):
"""
This function validates FF-M compliance for partition manifest, and sets
@@ -212,7 +243,7 @@
validate_dependency_chain(dependency, dependency_table, dependency_chain)
dependency_table[partition]['validated'] = True
-def process_partition_manifests(manifest_lists, isolation_level, backend):
+def process_partition_manifests(manifest_lists, configs):
"""
Parse the input manifest lists, check if manifest settings are valid,
generate the data base for generated files
@@ -221,11 +252,7 @@
Parameters
----------
manifest_lists:
- A list of Secure Partition manifest lists and their original paths.
- The manifest lists might be processed by CMake and the paths might be
- different to the original ones. Original paths are needed to handle
- relative paths in the lists.
- The format must be [list A, original path A, list B, orignal path B, ...]
+ A list of Secure Partition manifest lists
Returns
-------
@@ -256,42 +283,43 @@
'CONFIG_TFM_SLIH_API' : '0'
}
+ isolation_level = int(configs['TFM_ISOLATION_LEVEL'], base = 10)
+ backend = configs['CONFIG_TFM_SPM_BACKEND']
+
# Get all the manifests information as a dictionary
for i, item in enumerate(manifest_lists):
- if i % 2 == 0 and not os.path.isfile(item):
+ if not os.path.isfile(item):
logging.error('Manifest list item [{}] must be a file'.format(i))
exit(1)
- if i % 2 == 1:
- if not os.path.isdir(item):
- logging.error('Manifest list item [{}] must be a directory'.format(i))
- exit(1)
-
- # Skip original manifest paths
- continue
-
# The manifest list file generated by configure_file()
with open(item) as manifest_list_yaml_file:
manifest_dic = yaml.safe_load(manifest_list_yaml_file)['manifest_list']
for dict in manifest_dic:
- # Add original path of manifest list.
- # The validation will be done in the next loop.
- dict['list_path'] = manifest_lists[i + 1]
+ # Replace environment variables in the manifest path and convert to absolute path.
+ # If it's already abspath, the path will not be changed.
+ manifest_path = os.path.join(os.path.dirname(item), # path of manifest list
+ os.path.expandvars(dict['manifest']))\
+ .replace('\\', '/')
+ dict['manifest'] = manifest_path
all_manifests.append(dict)
logging.info("------------ Display partition configuration - start ------------")
# Parse the manifests
for i, manifest_item in enumerate(all_manifests):
- valid_enabled_conditions = ['on', 'true', 'enabled']
- valid_disabled_conditions = ['off', 'false', 'disabled', '']
+ valid_enabled_conditions = ['1', 'on', 'true', 'enabled']
+ valid_disabled_conditions = ['0', 'off', 'false', 'disabled', '']
is_enabled = ''
if 'conditional' in manifest_item.keys():
- is_enabled = str(manifest_item['conditional']).lower()
+ if manifest_item['conditional'] not in configs.keys():
+ logging.error('Configuration "{}" is not defined!'.format(manifest_item['conditional']))
+ exit(1)
+ is_enabled = configs[manifest_item['conditional']].lower()
else:
- # Partitions without 'conditional' are always on
- is_enabled = 'on'
+ # Partitions without 'conditional' is always on
+ is_enabled = '1'
if is_enabled in valid_disabled_conditions:
logging.info(" {:40s} OFF".format(manifest_item['name']))
@@ -318,11 +346,7 @@
else:
pid_list.append(pid)
- # Replace environment variables in the manifest path
- manifest_path = os.path.expandvars(manifest_item['manifest'])
- # Convert to absolute path. If it's already abspath, the path will not be changed.
- manifest_path = os.path.join(manifest_item['list_path'], manifest_path).replace('\\', '/')
-
+ manifest_path = manifest_item['manifest']
with open(manifest_path) as manifest_file:
manifest = yaml.safe_load(manifest_file)
if manifest.get('model', None) == 'dual':
@@ -655,18 +679,12 @@
, metavar='file-list'
, help='These files describe the file list to generate')
- parser.add_argument('-l', '--isolation-level'
- , dest='isolation_level'
+ parser.add_argument('-c', '--config-files'
+ , nargs='+'
+ , dest='config_files'
, required=True
- , choices=['1', '2', '3']
- , metavar='isolation-level')
-
- parser.add_argument('-b', '--backend'
- , dest='backend'
- , required=True
- , choices=['IPC', 'SFN']
- , metavar='spm-backend'
- , help='The isolation level')
+ , metavar='config-files'
+ , help='A header file contains build configurations')
parser.add_argument('-q', '--quiet'
, dest='quiet'
@@ -677,11 +695,6 @@
args = parser.parse_args()
- if len(args.manifest_lists) % 2 != 0:
- logging.error('Invalid structure in manifest lists.\n'
- 'Each element shall consist of a manifest list and its original path')
- exit(1)
-
return args
ENV = Environment(
@@ -721,8 +734,7 @@
os.chdir(os.path.join(sys.path[0], '..'))
context = process_partition_manifests(manifest_lists,
- int(args.isolation_level),
- args.backend)
+ parse_configurations(args.config_files))
utilities = {}
utilities['donotedit_warning'] = donotedit_warning
diff --git a/tools/tfm_psa_ff_test_manifest_list.yaml b/tools/tfm_psa_ff_test_manifest_list.yaml
index f61e1f9..e5b7c17 100644
--- a/tools/tfm_psa_ff_test_manifest_list.yaml
+++ b/tools/tfm_psa_ff_test_manifest_list.yaml
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -16,7 +16,7 @@
"short_name": "PSA_FF_TEST_CLIENT",
"manifest": "${PSA_ARCH_TESTS_PATH}/api-tests/platform/manifests/client_partition_psa.json",
"output_path": "api-tests/platform/manifests",
- "conditional": "@TFM_PARTITION_FF_TEST@",
+ "conditional": "TFM_PARTITION_FF_TEST",
"version_major": 0,
"version_minor": 1,
"pid": 5000,
@@ -34,7 +34,7 @@
"short_name": "PSA_FF_TEST_SERVER",
"manifest": "${PSA_ARCH_TESTS_PATH}/api-tests/platform/manifests/server_partition_psa.json",
"output_path": "api-tests/platform/manifests",
- "conditional": "@TFM_PARTITION_FF_TEST@",
+ "conditional": "TFM_PARTITION_FF_TEST",
"version_major": 0,
"version_minor": 1,
"pid": 5001,
@@ -52,7 +52,7 @@
"short_name": "PSA_FF_TEST_DRIVER",
"manifest": "${PSA_ARCH_TESTS_PATH}/api-tests/platform/manifests/driver_partition_psa.json",
"output_path": "api-tests/platform/manifests",
- "conditional": "@TFM_PARTITION_FF_TEST@",
+ "conditional": "TFM_PARTITION_FF_TEST",
"version_major": 0,
"version_minor": 1,
"pid": 5002,