aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorXinyu Zhang <xinyu.zhang@arm.com>2021-04-01 10:10:43 +0800
committerAnton Komlev <Anton.Komlev@arm.com>2021-04-14 22:56:59 +0200
commitc46ee1f4be567c0dbdb9dc74ed746586bdcbcf68 (patch)
treee02356512bfe7ed81f1cb124b8e2bad6f3650f2c /tools
parentcad01ab98c34bb3a13ab49da2672b8dab0dbb913 (diff)
downloadtrusted-firmware-m-c46ee1f4be567c0dbdb9dc74ed746586bdcbcf68.tar.gz
Tool: Automatically generate PIDs if needed
Add logic in existing manifest tools to automatically generate PIDs if not manually set. Manually assigned PIDs would be first reserved. Then assign unused PID Numbers to partitions without PID. Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com> Change-Id: Id3bab96b2f9dddd0a9859c9941469c5c98cfc71e
Diffstat (limited to 'tools')
-rw-r--r--tools/tfm_parse_manifest_list.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/tfm_parse_manifest_list.py b/tools/tfm_parse_manifest_list.py
index e788554bd..73c764139 100644
--- a/tools/tfm_parse_manifest_list.py
+++ b/tools/tfm_parse_manifest_list.py
@@ -76,14 +76,27 @@ 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')
- print("Start to generate PSA manifests:")
pid_list = []
- for manifest_item in manifest_list:
+ no_pid_manifest_idx = []
+ for i, manifest_item in enumerate(manifest_list):
+ # Check if partition ID is manually set
+ if 'pid' not in manifest_item.keys():
+ no_pid_manifest_idx.append(i)
+ continue
# Check if partition ID is duplicated
if manifest_item['pid'] in pid_list:
raise Exception("PID No. {pid} has already been used!".format(pid=manifest_item['pid']))
pid_list.append(manifest_item['pid'])
+ # Automatically generate PIDs for partitions without PID
+ pid = 256
+ for idx in no_pid_manifest_idx:
+ while pid in pid_list:
+ pid += 1
+ manifest_list[idx]['pid'] = pid
+ pid_list.append(pid)
+ print("Start to generate PSA manifests:")
+ for manifest_item in manifest_list:
# Replace environment variables in the manifest path
manifest_path = os.path.expandvars(manifest_item['manifest'])
file = open(manifest_path)