espressif: Improve CI script for targetting multiple chips at once

This enables using "espressif_run.sh" locally for a quick validation
that the build passes for multiple Espressif targets.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
diff --git a/.github/workflows/espressif.yaml b/.github/workflows/espressif.yaml
index ada3067..09870f5 100644
--- a/.github/workflows/espressif.yaml
+++ b/.github/workflows/espressif.yaml
@@ -23,7 +23,7 @@
         - "sign-rsa2048,sign-rsa3072,sign-ec256,sign-ed25519"
     runs-on: ubuntu-latest
     env:
-      MCUBOOT_TARGET: ${{ matrix.targets }}
+      MCUBOOT_TARGETS: ${{ matrix.targets }}
       MCUBOOT_FEATURES: ${{ matrix.features }}
     steps:
     - uses: actions/checkout@v2
diff --git a/ci/espressif_run.sh b/ci/espressif_run.sh
index 669c15e..5610468 100755
--- a/ci/espressif_run.sh
+++ b/ci/espressif_run.sh
@@ -16,8 +16,8 @@
 }
 
 build_mcuboot() {
-  local target=${MCUBOOT_TARGET}
-  local feature=${1}
+  local target=${1}
+  local feature=${2}
   local toolchain_file="${ESPRESSIF_ROOT}/tools/toolchain-${target}.cmake"
   local mcuboot_config="${ESPRESSIF_ROOT}/bootloader.conf"
   local build_dir=".build-${target}"
@@ -43,9 +43,12 @@
 
 if [ -n "${MCUBOOT_FEATURES}" ]; then
   IFS=','
-  read -ra feature_list <<< "${MCUBOOT_FEATURES}"
-  for feature in "${feature_list[@]}"; do
-    echo "Building MCUboot with support for \"${feature}\""
-    build_mcuboot "${feature}"
+  read -ra target_list <<< "${MCUBOOT_TARGETS}"
+  for target in "${target_list[@]}"; do
+    read -ra feature_list <<< "${MCUBOOT_FEATURES}"
+    for feature in "${feature_list[@]}"; do
+      echo "Building MCUboot for \"${target}\" with support for \"${feature}\""
+      build_mcuboot "${target}" "${feature}"
+    done
   done
 fi