Automaticly generate psa_crypto_driver_wrappers_no_static.c
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
diff --git a/scripts/generate_driver_wrappers.py b/scripts/generate_driver_wrappers.py
index e0c4793..5e2e5a9 100755
--- a/scripts/generate_driver_wrappers.py
+++ b/scripts/generate_driver_wrappers.py
@@ -1,9 +1,10 @@
#!/usr/bin/env python3
-"""Generate library/psa_crypto_driver_wrappers.c
+"""Generate library/psa_crypto_driver_wrappers.h
+ library/psa_crypto_driver_wrappers_no_static.c
This module is invoked by the build scripts to auto generate the
- psa_crypto_driver_wrappers.c based on template files in
- script/data_files/driver_templates/.
+ psa_crypto_driver_wrappers.h and psa_crypto_driver_wrappers_no_static
+ based on template files in script/data_files/driver_templates/.
"""
# Copyright The Mbed TLS Contributors
# SPDX-License-Identifier: Apache-2.0
@@ -59,19 +60,19 @@
return template.render(drivers=driver_jsoncontext)
-
def generate_driver_wrapper_file(template_dir: str,
output_dir: str,
+ template_file_name: str,
driver_jsoncontext: list) -> None:
"""
Generate the file psa_crypto_driver_wrapper.c.
"""
driver_wrapper_template_filename = \
- os.path.join(template_dir, "psa_crypto_driver_wrappers.c.jinja")
+ os.path.join(template_dir, template_file_name)
result = render(driver_wrapper_template_filename, driver_jsoncontext)
- with open(file=os.path.join(output_dir, "psa_crypto_driver_wrappers.c"),
+ with open(file=os.path.join(output_dir, template_file_name.rsplit(".", 1)[0]),
mode='w',
encoding='UTF-8') as out_file:
out_file.write(result)
@@ -167,6 +168,9 @@
), file)
+TEMPLATE_FILENAMES = ["psa_crypto_driver_wrappers.c.jinja",
+ "psa_crypto_driver_wrappers_no_static.c.jinja"]
+
def main() -> int:
"""
Main with command line arguments.
@@ -207,7 +211,9 @@
except DriverReaderException as e:
trace_exception(e)
return 1
- generate_driver_wrapper_file(template_directory, output_directory, merged_driver_json)
+ for template_filename in TEMPLATE_FILENAMES:
+ generate_driver_wrapper_file(template_directory, output_directory,
+ template_filename, merged_driver_json)
return 0