From ebcd85176215c0f53b8c572c5aed4c343e218130 Mon Sep 17 00:00:00 2001 From: Zingo Andersen Date: Tue, 12 Nov 2024 13:02:42 +0100 Subject: [PATCH] Arm backend: Speedup generation of C/C++ header of the pte file This fix a problem where Python 3.12.3 was slower then 3.10 to handle this part of the code. Signed-off-by: Zingo Andersen Change-Id: I116a3be950cd4016d40e1debb6bc237c07e9425e --- examples/arm/executor_runner/pte_to_header.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/arm/executor_runner/pte_to_header.py b/examples/arm/executor_runner/pte_to_header.py index 077df8d120f..a3ec40eede0 100644 --- a/examples/arm/executor_runner/pte_to_header.py +++ b/examples/arm/executor_runner/pte_to_header.py @@ -64,15 +64,15 @@ def input_file_path(path): with open(args.pte, "rb") as fr, open(outfile, "w") as fw: data = fr.read() hexstream = binascii.hexlify(data).decode("utf-8") - hexstring = attr + "model_pte[] = {" + fw.write(attr + "model_pte[] = {") for i in range(0, len(hexstream), 2): if 0 == (i % hex_digits_per_line): - hexstring += "\n" - hexstring += "0x" + hexstream[i : i + 2] + ", " + fw.write("\n") + fw.write("0x" + hexstream[i : i + 2] + ", ") + + fw.write("};\n") - hexstring += "};\n" - fw.write(hexstring) print( - f"Input: {args.pte} with {len(data)} bytes. Output: {outfile} with {len(hexstring)} bytes. Section: {args.section}." + f"Input: {args.pte} with {len(data)} bytes. Output: {outfile} with {fw.tell()} bytes. Section: {args.section}." )