lava_helper: Add multiple image support to jinja2 binary templating

Signed-off-by: Gergely Korcsák <gergely.korcsak@arm.com>
Change-Id: I1cf213f50dd8e6aa566ee985637ed0e4c2c9a931
diff --git a/lava_helper/jinja2_templates/b_u585i_iot02a.jinja2 b/lava_helper/jinja2_templates/b_u585i_iot02a.jinja2
index c1aa3c4..e51b2aa 100644
--- a/lava_helper/jinja2_templates/b_u585i_iot02a.jinja2
+++ b/lava_helper/jinja2_templates/b_u585i_iot02a.jinja2
@@ -1,5 +1,5 @@
 {#------------------------------------------------------------------------------
-# Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -12,8 +12,10 @@
           minutes: 12
         to: flasher
         images:
-          tarball:
-            url: {{ tarball_url }}
+{% for name, img in binaries.items() %}
+          {{ name }}:
+            url: {{ data_url_prefix }}/{{ img.data }}
+{% endfor %}
 
     - boot:
         method: minimal
diff --git a/lava_helper/jinja2_templates/fvp_corstone1000.jinja2 b/lava_helper/jinja2_templates/fvp_corstone1000.jinja2
index ec2c841..d70c65f 100644
--- a/lava_helper/jinja2_templates/fvp_corstone1000.jinja2
+++ b/lava_helper/jinja2_templates/fvp_corstone1000.jinja2
@@ -1,5 +1,5 @@
 {#------------------------------------------------------------------------------
-# Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -20,10 +20,14 @@
     namespace: docker
     to: fvp
     images:
-      app:
-        url: {{ application_url }}
-      data:
-        url: {{ data_url }}
+{% for name, img in binaries.items() %}
+      {{ name }}:
+    {% if img.application is defined %}
+        url: {{ data_url_prefix }}/{{ img.application }}
+    {% else %}
+        url: {{ data_url_prefix }}/{{ img.data }}
+    {% endif %}
+{% endfor %}
 - boot:
     failure_retry: 3
     namespace: docker
@@ -40,14 +44,19 @@
     license_variable: '{{ license_variable }}'
     use_telnet: True
     arguments:
-    -  "-C se.trustedBootROMloader.fname=\"{APP}\""
+{% for name, img in binaries.items() %}
+    {% if img.application is defined %}
+    -  "-C se.trustedBootROMloader.fname=\"{{ '{' ~ name.upper() ~ '}' }}\""
+    {% else %}
+    -  "--data board.flash0={{ '{' ~ name.upper() ~ '}' }}@{{ img.offset }}"
+    {% endif %}
+{% endfor %}
     -  "-C board.flashloader0.fname=\"none\""
     -  "-C board.xnvm_size=64"
     -  "-C se.trustedSRAM_config=6"
     -  "-C se.BootROM_config=\"3\""
     -  "-C board.smsc_91c111.enabled=0"
     -  "-C board.hostbridge.userNetworking=true"
-    -  "--data board.flash0={DATA}@{{ data_bin_offset }}"
     -  "-C diagnostics=4"
     -  "-C disable_visualisation=true"
     -  "-C board.se_flash_size=8192"
diff --git a/lava_helper/jinja2_templates/fvp_mps2.jinja2 b/lava_helper/jinja2_templates/fvp_mps2.jinja2
index d650670..e203f40 100644
--- a/lava_helper/jinja2_templates/fvp_mps2.jinja2
+++ b/lava_helper/jinja2_templates/fvp_mps2.jinja2
@@ -1,5 +1,5 @@
 {#------------------------------------------------------------------------------
-# Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -20,10 +20,14 @@
     namespace: docker
     to: fvp
     images:
-      app:
-        url: {{ application_url }}
-      data:
-        url: {{ data_url }}
+{% for name, img in binaries.items() %}
+      {{ name }}:
+    {% if img.application is defined %}
+        url: {{ data_url_prefix }}/{{ img.application }}
+    {% else %}
+        url: {{ data_url_prefix }}/{{ img.data }}
+    {% endif %}
+{% endfor %}
 {%- if enable_code_coverage %}
       cc:
         url: {{ coverage_trace_plugin }}
@@ -57,8 +61,13 @@
     -  "/opt/model/FVP_ARM_Std_Library/FVP_MPS2/FVP_MPS2_AEMv8M"
 {%- endif %}
     -  "--simlimit 900"
-    -  "--application cpu0={APP}"
-    -  "--data cpu0={DATA}@{{ data_bin_offset }}"
+{% for name, img in binaries.items() %}
+    {% if img.application is defined %}
+    -  "--application cpu0={{ '{' ~ name.upper() ~ '}' }}"
+    {% else %}
+    -  "--data cpu0={{ '{' ~ name.upper() ~ '}' }}@{{ img.offset }}"
+    {% endif %}
+{% endfor %}
     -  "--parameter fvp_mps2.platform_type=2"
     -  "--parameter cpu0.baseline={{ cpu0_baseline }}"
     -  "--parameter cpu0.INITVTOR_S={{ cpu0_initvtor_s }}"
diff --git a/lava_helper/jinja2_templates/fvp_mps3.jinja2 b/lava_helper/jinja2_templates/fvp_mps3.jinja2
index 1b6d95e..5e7c0cf 100644
--- a/lava_helper/jinja2_templates/fvp_mps3.jinja2
+++ b/lava_helper/jinja2_templates/fvp_mps3.jinja2
@@ -1,5 +1,5 @@
 {#------------------------------------------------------------------------------
-# Copyright (c) 2018-2023, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -20,10 +20,14 @@
     namespace: docker
     to: fvp
     images:
-      app:
-        url: {{ application_url }}
-      data:
-        url: {{ data_url }}
+{% for name, img in binaries.items() %}
+      {{ name }}:
+    {% if img.application is defined %}
+        url: {{ data_url_prefix }}/{{ img.application }}
+    {% else %}
+        url: {{ data_url_prefix }}/{{ img.data }}
+    {% endif %}
+{% endfor %}
 {%- if enable_code_coverage %}
       cc:
         url: {{ coverage_trace_plugin }}
@@ -45,8 +49,13 @@
     use_telnet: False
     arguments:
     -  "--simlimit 900"
-    -  "--application cpu0={APP}"
-    -  "--data cpu0={DATA}@{{ data_bin_offset }}"
+{% for name, img in binaries.items() %}
+    {% if img.application is defined %}
+    -  "--application cpu0={{ '{' ~ name.upper() ~ '}' }}"
+    {% else %}
+    -  "--data cpu0={{ '{' ~ name.upper() ~ '}' }}@{{ img.offset }}"
+    {% endif %}
+{% endfor %}
     -  "--parameter mps3_board.platform_type=1"
     -  "--parameter cpu0.INITSVTOR={{ cpu0_initvtor_s }}"
     -  "--parameter cpu0.semihosting-enable=0"
diff --git a/lava_helper/jinja2_templates/lpcxpresso55s69.jinja2 b/lava_helper/jinja2_templates/lpcxpresso55s69.jinja2
index f95c437..e51b2aa 100644
--- a/lava_helper/jinja2_templates/lpcxpresso55s69.jinja2
+++ b/lava_helper/jinja2_templates/lpcxpresso55s69.jinja2
@@ -1,5 +1,5 @@
 {#------------------------------------------------------------------------------
-# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -12,8 +12,10 @@
           minutes: 12
         to: flasher
         images:
-          tarball:
-            url: {{ tarball_url }}
+{% for name, img in binaries.items() %}
+          {{ name }}:
+            url: {{ data_url_prefix }}/{{ img.data }}
+{% endfor %}
 
     - boot:
         method: minimal
diff --git a/lava_helper/jinja2_templates/mps2.jinja2 b/lava_helper/jinja2_templates/mps2.jinja2
index 2df0641..bc5f4df 100644
--- a/lava_helper/jinja2_templates/mps2.jinja2
+++ b/lava_helper/jinja2_templates/mps2.jinja2
@@ -1,5 +1,5 @@
 {#------------------------------------------------------------------------------
-# Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -21,10 +21,10 @@
       recovery_image:
         url: {{ recovery_image_url }}
         compression: gz
-      test_binary_1:
-        url: {{ firmware_url }}
-      test_binary_2:
-        url: {{ bootloader_url }}
+{% for name, img in binaries.items() %}
+      {{ name }}:
+        url: {{ data_url_prefix }}/{{ img.data }}
+{% endfor %}
     namespace: target
 
 - boot:
diff --git a/lava_helper/jinja2_templates/musca_b1.jinja2 b/lava_helper/jinja2_templates/musca_b1.jinja2
index 7bc2d88..c1396f9 100644
--- a/lava_helper/jinja2_templates/musca_b1.jinja2
+++ b/lava_helper/jinja2_templates/musca_b1.jinja2
@@ -1,5 +1,5 @@
 {#------------------------------------------------------------------------------
-# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -12,8 +12,10 @@
           minutes: 12
         to: musca
         images:
-          test_binary:
-            url: {{ firmware_url }}
+{% for name, img in binaries.items() %}
+          {{ name }}:
+            url: {{ data_url_prefix }}/{{ img.data }}
+{% endfor %}
 
     - boot:
         method: musca
diff --git a/lava_helper/jinja2_templates/psoc64.jinja2 b/lava_helper/jinja2_templates/psoc64.jinja2
index cc40483..88031ec 100644
--- a/lava_helper/jinja2_templates/psoc64.jinja2
+++ b/lava_helper/jinja2_templates/psoc64.jinja2
@@ -1,5 +1,5 @@
 {#------------------------------------------------------------------------------
-# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -12,10 +12,10 @@
           minutes: 12
         to: flasher
         images:
-          spe:
-            url: {{ spe_url }}
-          nspe:
-            url: {{ nspe_url }}
+{% for name, img in binaries.items() %}
+          {{ name }}:
+            url: {{ data_url_prefix }}/{{ img.data }}
+{% endfor %}
 
     - boot:
         method: minimal
diff --git a/lava_helper/jinja2_templates/qemu_mps2_bl2.jinja2 b/lava_helper/jinja2_templates/qemu_mps2_bl2.jinja2
index 2a6da2d..84f32fd 100644
--- a/lava_helper/jinja2_templates/qemu_mps2_bl2.jinja2
+++ b/lava_helper/jinja2_templates/qemu_mps2_bl2.jinja2
@@ -1,5 +1,5 @@
 {#------------------------------------------------------------------------------
-# Copyright (c) 2019-2022, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2019-2024, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -7,8 +7,11 @@
 actions:
 - deploy:
     images:
-      mcuboot: {image_arg: '-device loader,file={mcuboot},addr=0x10000000', url: '{{ bootloader_url }}'}
-      tfm: {image_arg: '-device loader,file={tfm},addr=0x10080000', url: '{{ firmware_url }}'}
+{% for name, img in binaries.items() %}
+      {{ name }}:
+        image_arg: "{{ '-device loader,file={' ~ name ~ '},addr=' ~ img.offset }}"
+        url: {{ data_url_prefix }}/{{ img.data }}
+{% endfor %}
     to: tmpfs
 - boot:
     docker: {binary: /usr/bin/qemu-system-arm, image: 'trustedfirmware/ci-amd64-tf-m-qemu-debian:bullseye'}
diff --git a/lava_helper/jinja2_templates/stm32h573i_dk.jinja2 b/lava_helper/jinja2_templates/stm32h573i_dk.jinja2
index c1aa3c4..e51b2aa 100644
--- a/lava_helper/jinja2_templates/stm32h573i_dk.jinja2
+++ b/lava_helper/jinja2_templates/stm32h573i_dk.jinja2
@@ -1,5 +1,5 @@
 {#------------------------------------------------------------------------------
-# Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -12,8 +12,10 @@
           minutes: 12
         to: flasher
         images:
-          tarball:
-            url: {{ tarball_url }}
+{% for name, img in binaries.items() %}
+          {{ name }}:
+            url: {{ data_url_prefix }}/{{ img.data }}
+{% endfor %}
 
     - boot:
         method: minimal
diff --git a/lava_helper/jinja2_templates/stm32l562e_dk.jinja2 b/lava_helper/jinja2_templates/stm32l562e_dk.jinja2
index 8c00dd7..8b9426d 100644
--- a/lava_helper/jinja2_templates/stm32l562e_dk.jinja2
+++ b/lava_helper/jinja2_templates/stm32l562e_dk.jinja2
@@ -1,5 +1,5 @@
 {#------------------------------------------------------------------------------
-# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -12,8 +12,10 @@
           minutes: 12
         to: flasher
         images:
-          tarball:
-            url: {{ tarball_url }}
+{% for name, img in binaries.items() %}
+          {{ name }}:
+            url: {{ data_url_prefix }}/{{ img.data }}
+{% endfor %}
 
     - boot:
         method: musca