Infineon: Add cyw20829 platform, shared slot feature, json memory map, psoc6 xip

Based in 1.8.0 release of MCUBoot library

This commit adds CYW20829 Infineon platform support with following capabilities:
1. Overwrite and swap upgrade mode support
2. Multi-image with up to 4 images
3. Hardware security counter is supported for CYW20829 platform

Add XIP support for PSOC6 platform - place BOOT slot in external memory and execute it in place using SMIF in XIP mode

and some new features for Infineon devices.

1. Shared upgrade slot feature - use one shared area for upgrade slots of multiple images
2. Memory map defined using JSON file - define memory regions for bootloader and user app in conventional way using JSON file
diff --git a/ci/check-signed-off-by.sh b/ci/check-signed-off-by.sh
index f71e68f..c52a339 100755
--- a/ci/check-signed-off-by.sh
+++ b/ci/check-signed-off-by.sh
@@ -45,10 +45,10 @@
   IFS=$'\n'
   for line in ${lines}; do
     stripped=$(echo $line | sed -e 's/^\s*//' | sed -e 's/\s*$//')
-    if [[ ${stripped} == ${author} ]]; then
+    if [[ "${stripped}" == "${author}" ]]; then
       found_author=true
     fi
-    if [[ ${stripped} == ${committer} ]]; then
+    if [[ "${stripped}" == "${committer}" ]]; then
       found_committer=true
     fi
 
diff --git a/ci/fih-tests_install.sh b/ci/fih-tests_install.sh
index fb6e0fb..d69308a 100755
--- a/ci/fih-tests_install.sh
+++ b/ci/fih-tests_install.sh
@@ -18,13 +18,15 @@
 
 DOCKER_DIR=docker
 
-IMAGE=fih-test:0.0.1
+IMAGE=fih-test:0.0.2
 
 CACHED_IMAGE=$DOCKER_DIR/$IMAGE
 
 [[ -f $CACHED_IMAGE ]] && (gzip -dc $CACHED_IMAGE | docker load)
 
 if [[ $? -ne 0 ]]; then
-  docker pull mcuboot/$IMAGE
-  docker save mcuboot/$IMAGE | gzip > $CACHED_IMAGE
+    docker pull mcuboot/$IMAGE
+    if [[ $GITHUB_ACTIONS != true ]]; then
+        docker save mcuboot/$IMAGE | gzip > $CACHED_IMAGE
+    fi
 fi
diff --git a/ci/fih-tests_run.sh b/ci/fih-tests_run.sh
index 37d8a73..5b975d3 100755
--- a/ci/fih-tests_run.sh
+++ b/ci/fih-tests_run.sh
@@ -1,6 +1,6 @@
 #!/bin/bash -x
 
-# Copyright (c) 2020 Arm Limited
+# Copyright (c) 2020-2021 Arm Limited
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,9 +19,31 @@
 pushd .. &&\
    git clone https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git &&\
    pushd trusted-firmware-m &&\
-   git checkout 7ad5c5f23f4619add4aa6c88f4b25fc6fd84ec6e &&\
+   git checkout TF-Mv1.4.0 &&\
    popd
 
+if [[ $GITHUB_ACTIONS == true ]]; then
+    if [[ -z $FIH_ENV ]]; then
+        echo "Workflow has found no \$FIH_ENV"
+        exit 1
+    fi
+
+    args=($FIH_ENV)
+    len=${#args[@]}
+    if [[ $len < 3 ]]; then
+        echo "Invalid number of \$FIH_ENV args"
+        exit 1
+    fi
+
+    BUILD_TYPE=${args[0]}
+    SKIP_SIZE=${args[1]}
+    DAMAGE_TYPE=${args[2]}
+
+    if [[ $len > 3 ]]; then
+        FIH_LEVEL=${args[3]}
+    fi
+fi
+
 if test -z "$FIH_LEVEL"; then
     docker run --rm -v $(pwd):/root/work/tfm:rw,z mcuboot/fih-test /bin/sh -c '/root/work/tfm/mcuboot/ci/fih_test_docker/execute_test.sh $0 $1 $2' $SKIP_SIZE $BUILD_TYPE $DAMAGE_TYPE
 else
diff --git a/ci/fih_test_docker/execute_test.sh b/ci/fih_test_docker/execute_test.sh
index 9193564..3d09993 100755
--- a/ci/fih_test_docker/execute_test.sh
+++ b/ci/fih_test_docker/execute_test.sh
@@ -1,6 +1,6 @@
 #!/bin/bash -x
 
-# Copyright (c) 2020 Arm Limited
+# Copyright (c) 2020-2021 Arm Limited
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -37,21 +37,21 @@
 mkdir -p $TFM_BUILD_DIR
 cd $TFM_DIR
 cmake -B $TFM_BUILD_DIR \
+    -DTFM_SPM_LOG_LEVEL=TFM_SPM_LOG_LEVEL_INFO \
     -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
     -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake \
-    -DTFM_PLATFORM=mps2/an521 \
+    -DTFM_PLATFORM=arm/mps2/an521 \
     -DTEST_NS=ON \
     -DTEST_S=ON \
     -DTFM_PSA_API=ON \
     -DMCUBOOT_PATH=$MCUBOOT_PATH \
     -DMCUBOOT_LOG_LEVEL=INFO \
-    -DTFM_TEST_REPO_VERSION=93ce2f59c0c4a9cba6062834496b5f45deee4010 \
     $CMAKE_FIH_LEVEL \
     .
 cd $TFM_BUILD_DIR
 make -j install
 
-BOOTLOADER_AXF='./install/outputs/MPS2/AN521/bl2.axf'
+BOOTLOADER_AXF='./install/outputs/ARM/MPS2/AN521/bl2.axf'
 
 $MCUBOOT_PATH/ci/fih_test_docker/run_fi_test.sh $BOOTLOADER_AXF $SKIP_SIZE $DAMAGE_TYPE> fih_test_output.yaml
 
diff --git a/ci/fih_test_docker/fi_tester_gdb.sh b/ci/fih_test_docker/fi_tester_gdb.sh
index 05f0492..2a20a1d 100755
--- a/ci/fih_test_docker/fi_tester_gdb.sh
+++ b/ci/fih_test_docker/fi_tester_gdb.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-# Copyright (c) 2020 Arm Limited
+# Copyright (c) 2020-2021 Arm Limited
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -104,7 +104,7 @@
                 echo "    test_exec_ok: True"
                 echo "    skipped: True"
                 echo "    boot: False"
-                echo "    last_line: '$LAST_LINE' "
+                echo "    last_line: \"$LAST_LINE\" "
             fi
         else
             # The target was not stopped at the desired address.
@@ -138,7 +138,7 @@
 
 #defaults
 SKIP=2
-BIN_DIR=$(pwd)/install/outputs/MPS2/AN521
+BIN_DIR=$(pwd)/install/outputs/ARM/MPS2/AN521
 AXF_FILE=$BIN_DIR/bl2.axf
 GDB=gdb-multiarch
 BOOTLOADER=true
diff --git a/ci/imgtool_install.sh b/ci/imgtool_install.sh
index 091cfa7..66b44cf 100755
--- a/ci/imgtool_install.sh
+++ b/ci/imgtool_install.sh
@@ -13,8 +13,8 @@
 # limitations under the License.
 
 if [[ $TRAVIS == "true" ]]; then
-    if [[ $TRAVIS_PULL_REQUEST != "false" || $TRAVIS_BRANCH != "master" ]]; then
-        echo "Either a PR or not \"master\" branch, exiting"
+    if [[ $TRAVIS_PULL_REQUEST != "false" || $TRAVIS_BRANCH != "main" ]]; then
+        echo "Either a PR or not \"main\" branch, exiting"
         exit 0
     fi
 fi
diff --git a/ci/imgtool_run.sh b/ci/imgtool_run.sh
index 7358706..97f0b21 100755
--- a/ci/imgtool_run.sh
+++ b/ci/imgtool_run.sh
@@ -13,8 +13,8 @@
 # limitations under the License.
 
 if [[ $TRAVIS == "true" ]]; then
-    if [[ $TRAVIS_PULL_REQUEST != "false" || $TRAVIS_BRANCH != "master" ]]; then
-        echo "Either a PR or not \"master\" branch, exiting"
+    if [[ $TRAVIS_PULL_REQUEST != "false" || $TRAVIS_BRANCH != "main" ]]; then
+        echo "Either a PR or not \"main\" branch, exiting"
         exit 0
     fi
 fi