CI: Add idf_target for esp_example.sh script (#32809)
* CI: Add idf_target for esp_example.sh script
* review changes
* fix ci build for lock app
diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml
index 09d2b24..d262bd7 100644
--- a/.github/workflows/examples-esp32.yaml
+++ b/.github/workflows/examples-esp32.yaml
@@ -90,8 +90,8 @@
rm -rf ./zzz_pregenerated
mv scripts/codegen.py.renamed scripts/codegen.py
mv scripts/tools/zap/generate.py.renamed scripts/tools/zap/generate.py
- - name: Build example All Clusters App C3
- run: scripts/examples/esp_example.sh all-clusters-app sdkconfig_c3devkit.defaults
+ - name: Build example All Clusters App(Target:ESP32C3)
+ run: scripts/examples/esp_example.sh all-clusters-app sdkconfig.defaults.esp32c3 esp32c3
- name: Copy aside build products
run: |
mkdir -p example_binaries/esp32-build
@@ -106,10 +106,10 @@
run: scripts/examples/esp_example.sh pigweed-app sdkconfig.defaults
- name: Build example Lighting App (Target:ESP32H2)
- run: scripts/examples/esp_example.sh lighting-app sdkconfig.defaults.esp32h2
+ run: scripts/examples/esp_example.sh lighting-app sdkconfig.defaults.esp32h2 esp32h2
- name: Build example Lock App (Target:ESP32C6)
- run: scripts/examples/esp_example.sh lock-app sdkconfig.defaults.esp32c6
+ run: scripts/examples/esp_example.sh lock-app sdkconfig.defaults.esp32c6 esp32c6
- name: Uploading Size Reports
uses: ./.github/actions/upload-size-reports
@@ -155,10 +155,13 @@
run: scripts/examples/esp_example.sh ota-provider-app sdkconfig.defaults
- name: Build example Light Switch App (Target:ESP32C3)
- run: scripts/examples/esp_example.sh light-switch-app sdkconfig.defaults.esp32c3
+ run: scripts/examples/esp_example.sh light-switch-app sdkconfig.defaults.esp32c3 esp32c3
- name: Build example Lighting App (external platform)
run: scripts/examples/esp_example.sh lighting-app sdkconfig.ext_plat.defaults
- name: Build example Energy Management App
run: scripts/examples/esp_example.sh energy-management-app sdkconfig.defaults
+
+ - name: Build example LIT ICD App (Target:ESP32H2)
+ run: scripts/examples/esp_example.sh lit-icd-app sdkconfig.defaults esp32h2
diff --git a/examples/all-clusters-app/esp32/sdkconfig_c3devkit.defaults b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c3
similarity index 100%
rename from examples/all-clusters-app/esp32/sdkconfig_c3devkit.defaults
rename to examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c3
diff --git a/examples/platform/esp32/lock/AppConfig.h b/examples/platform/esp32/lock/AppConfig.h
index e90d9a1..243168c 100644
--- a/examples/platform/esp32/lock/AppConfig.h
+++ b/examples/platform/esp32/lock/AppConfig.h
@@ -26,7 +26,7 @@
#define APP_LOCK_BUTTON GPIO_NUM_34
#define APP_FUNCTION_BUTTON GPIO_NUM_35
-#elif CONFIG_IDF_TARGET_ESP32C3
+#elif CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6
#define SYSTEM_STATE_LED GPIO_NUM_8
#define LOCK_STATE_LED GPIO_NUM_9
diff --git a/scripts/build/builders/esp32.py b/scripts/build/builders/esp32.py
index b51e23d..468a920 100644
--- a/scripts/build/builders/esp32.py
+++ b/scripts/build/builders/esp32.py
@@ -139,7 +139,7 @@
else:
return 'sdkconfig{}.defaults'.format(rpc)
elif board == Esp32Board.C3DevKit:
- return 'sdkconfig_c3devkit{}.defaults'.format(rpc)
+ return 'sdkconfig{}.defaults.esp32c3'.format(rpc)
else:
raise Exception('Unknown board type')
diff --git a/scripts/examples/esp_example.sh b/scripts/examples/esp_example.sh
index c6c4bc4..d779996 100755
--- a/scripts/examples/esp_example.sh
+++ b/scripts/examples/esp_example.sh
@@ -21,6 +21,7 @@
app="$1"
sdkconfig_name="$2"
+idf_target="$3"
root=examples/$app/esp32
shift 1
@@ -30,16 +31,16 @@
exit 1
fi
+supported_idf_target=("esp32" "esp32c3" "esp32c2" "esp32c6" "esp32s3" "esp32h2")
+
+if [ -z "$idf_target" ] || [[ ! "${supported_idf_target[*]}" =~ "$idf_target" ]]; then
+ idf_target="esp32"
+fi
+
source "$IDF_PATH/export.sh"
source "scripts/activate.sh"
# shellcheck source=/dev/null
-if [ "$sdkconfig_name" == "sdkconfig_c3devkit.defaults" ]; then
- idf_target="esp32c3"
-else
- idf_target="esp32"
-fi
-
rm -f "$root"/sdkconfig
(
cd "$root"
@@ -48,4 +49,7 @@
echo "build $sdkconfig_name failed"
exit 1
}
-cp "$root"/build/chip-"$app".elf "$root"/build/"${sdkconfig_name%".defaults"}"-chip-"$app".elf
+
+project_name=$(grep -o 'project([^)]*)' "$root"/CMakeLists.txt | sed 's/project(\(.*\))/\1/')
+
+cp "$root"/build/"$project_name".elf "$root"/build/"${sdkconfig_name%".defaults"}"-"$project_name".elf