Merge branch 'release/2.1.x'

Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
Change-Id: I9429513dfed9e08de3044fa0a70d660eb27ba9fc
diff --git a/build_helper/build_helper_configs.py b/build_helper/build_helper_configs.py
index bd124e0..1d2f576 100755
--- a/build_helper/build_helper_configs.py
+++ b/build_helper/build_helper_configs.py
@@ -89,7 +89,8 @@
     "post_build": {"arm/corstone1000": ("dd conv=notrunc bs=1 if=%(ci_build_root_dir)s/spe/bin/bl1_1.bin of=%(ci_build_root_dir)s/spe/bin/bl1.bin seek=0;"
                                         "dd conv=notrunc bs=1 if=%(ci_build_root_dir)s/spe/bin/bl1_provisioning_bundle.bin of=%(ci_build_root_dir)s/spe/bin/bl1.bin seek=40960;"
                                         "%(codebase_root_dir)s/platform/ext/target/arm/corstone1000/create-flash-image.sh %(ci_build_root_dir)s/spe/bin/ cs1000.bin;"),
-                    "arm/musca_b1": ("srec_cat "
+                    "arm/musca_b1": ("if [ -f \"%(ci_build_root_dir)s/nspe\" ]; then "
+                                     "srec_cat "
                                      "%(ci_build_root_dir)s/spe/bin/"
                                      "bl2.bin "
                                      "-Binary -offset 0xA000000 "
@@ -99,8 +100,22 @@
                                      "-Binary -offset 0xA020000 "
                                      "-fill 0xFF 0xA020000 0xA200000 "
                                      "-o %(ci_build_root_dir)s/"
-                                     "spe/bin/tfm.hex -Intel"),
-                   "arm/musca_s1": ("srec_cat "
+                                     "spe/bin/tfm.hex -Intel;"
+                                     "else "
+                                     "srec_cat "
+                                     "%(ci_build_root_dir)s/spe/bin/"
+                                     "bl2.bin "
+                                     "-Binary -offset 0xA000000 "
+                                     "-fill 0xFF 0xA000000 0xA020000 "
+                                     "%(ci_build_root_dir)s/spe/bin/"
+                                     "tfm_s_signed.bin "
+                                     "-Binary -offset 0xA020000 "
+                                     "-fill 0xFF 0xA020000 0xA200000 "
+                                     "-o %(ci_build_root_dir)s/"
+                                     "spe/bin/tfm.hex -Intel;"
+                                     "fi;"),
+                   "arm/musca_s1": ("if [ -f \"%(ci_build_root_dir)s/nspe\" ]; then "
+                                    "srec_cat "
                                     "%(ci_build_root_dir)s/spe/bin/"
                                     "bl2.bin "
                                     "-Binary -offset 0xA000000 "
@@ -110,7 +125,20 @@
                                     "-Binary -offset 0xA020000 "
                                     "-fill 0xFF 0xA020000 0xA200000 "
                                     "-o %(ci_build_root_dir)s/"
-                                    "spe/bin/tfm.hex -Intel"),
+                                    "spe/bin/tfm.hex -Intel; "
+                                    "else "
+                                    "srec_cat "
+                                    "%(ci_build_root_dir)s/spe/bin/"
+                                    "bl2.bin "
+                                    "-Binary -offset 0xA000000 "
+                                    "-fill 0xFF 0xA000000 0xA020000 "
+                                    "%(ci_build_root_dir)s/spe/bin/"
+                                    "tfm_s_signed.bin "
+                                    "-Binary -offset 0xA020000 "
+                                    "-fill 0xFF 0xA020000 0xA200000 "
+                                    "-o %(ci_build_root_dir)s/"
+                                    "spe/bin/tfm.hex -Intel;"
+                                    "fi;"),
                    "stm/stm32l562e_dk": ("echo 'STM32L562E-DK board post process';"
                                           "%(ci_build_root_dir)s/spe/api_ns/postbuild.sh;"
                                           "pushd %(ci_build_root_dir)s/spe/api_ns;"
diff --git a/jenkins/build-config.jpl b/jenkins/build-config.jpl
index 994e259..9cb2175 100644
--- a/jenkins/build-config.jpl
+++ b/jenkins/build-config.jpl
@@ -41,6 +41,9 @@
         sh "tf-m-ci-scripts/run-build.sh"
       }
       stage("Post") {
+        // Temporary, for debugging https://linaro.atlassian.net/browse/TFC-615
+        archiveArtifacts artifacts: 'ci_build/**', allowEmptyArchive: true
+
         archiveArtifacts 'ci_build/spe/bin/**'
         archiveArtifacts 'ci_build/spe/api_ns/bin/**'
         archiveArtifacts 'ci_build/spe/api_ns/interface/**'
@@ -66,6 +69,7 @@
         }
       }
     } catch (Exception e) {
+      println("Archiving all build files due to build error (to allow investigate it)")
       archiveArtifacts artifacts: 'ci_build/**', allowEmptyArchive: true
       manager.buildFailure()
       verify = -1
diff --git a/lava_helper/lava_wait_jobs.py b/lava_helper/lava_wait_jobs.py
index 50cae41..12862c5 100755
--- a/lava_helper/lava_wait_jobs.py
+++ b/lava_helper/lava_wait_jobs.py
@@ -76,7 +76,10 @@
             info['job_dir'] = os.path.join(user_args.artifacts_path, "{}_{}".format(str(job), info['description']))
         to_fetch = {job_id: info for job_id, info in finished_jobs.items() if job_id not in fetched_artifacts}
         _log.info("Fetching artifacts for remaining jobs: %s", to_fetch.keys())
-        fetch_artifacts(to_fetch, user_args, lava)
+        try:
+            fetch_artifacts(to_fetch, user_args, lava)
+        except Exception as e:
+            _log.exception("Still failed to fetch artifacts for some jobs; continuing, but overall result is failure")
     return finished_jobs
 
 def resubmit_failed_jobs(jobs, user_args):
diff --git a/tfm_ci_pylib/tfm_build_manager.py b/tfm_ci_pylib/tfm_build_manager.py
index 1c59d95..bc8bdfd 100644
--- a/tfm_ci_pylib/tfm_build_manager.py
+++ b/tfm_ci_pylib/tfm_build_manager.py
@@ -399,9 +399,8 @@
         # these also need to be substituted
         overwrite_params["extra_params"] = self.map_params(i.extra_params, mapExtraParams) % overwrite_params
 
-        # Print more cmake command details to debug issue in Isolation Level 3
-        if i.isolation_level == "3":
-            overwrite_params["extra_params"] += " -DCMAKE_VERBOSE_MAKEFILE=ON"
+        # Print more cmake command details to debug any issues
+        overwrite_params["extra_params"] += " -DCMAKE_VERBOSE_MAKEFILE=ON"
 
         if i.test_psa_api == "IPC":
             overwrite_params["test_psa_api"] += " -DINCLUDE_PANIC_TESTS=1"