Skip to content

Commit

Permalink
CI: Add idf_target for esp_example.sh script (#32809)
Browse files Browse the repository at this point in the history
* CI: Add idf_target for esp_example.sh script

* review changes

* fix ci build for lock app
  • Loading branch information
wqx6 committed Apr 3, 2024
1 parent a7839b0 commit e53dca8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/examples-esp32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ jobs:
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
Expand All @@ -106,10 +106,10 @@ jobs:
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
Expand Down Expand Up @@ -155,10 +155,13 @@ jobs:
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
2 changes: 1 addition & 1 deletion examples/platform/esp32/lock/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion scripts/build/builders/esp32.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def DefaultsFileName(board: Esp32Board, app: Esp32App, enable_rpcs: bool):
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')

Expand Down
18 changes: 11 additions & 7 deletions scripts/examples/esp_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env

app="$1"
sdkconfig_name="$2"
idf_target="$3"
root=examples/$app/esp32

shift 1
Expand All @@ -30,16 +31,16 @@ if [ -z "$app" ]; then
exit 1
fi

source "$IDF_PATH/export.sh"
source "scripts/activate.sh"
# shellcheck source=/dev/null
supported_idf_target=("esp32" "esp32c3" "esp32c2" "esp32c6" "esp32s3" "esp32h2")

if [ "$sdkconfig_name" == "sdkconfig_c3devkit.defaults" ]; then
idf_target="esp32c3"
else
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

rm -f "$root"/sdkconfig
(
cd "$root"
Expand All @@ -48,4 +49,7 @@ rm -f "$root"/sdkconfig
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

0 comments on commit e53dca8

Please sign in to comment.