From 392d085877367e8744d760a83a00f22d011747f1 Mon Sep 17 00:00:00 2001 From: Sweety Date: Tue, 20 Jul 2021 01:20:44 +0530 Subject: [PATCH] ESP32: Optimize the time taken by esp32 workflows (#8409) --- .github/workflows/examples-esp32.yaml | 32 ++++++--- .../esp32/sdkconfig_devkit.defaults | 46 ------------ .../esp32/sdkconfig_devkit.defaults | 71 ------------------- scripts/build/builders/esp32.py | 2 +- scripts/examples/esp_example.sh | 37 +++++----- 5 files changed, 42 insertions(+), 146 deletions(-) delete mode 100644 examples/all-clusters-app/esp32/sdkconfig_devkit.defaults delete mode 100644 examples/temperature-measurement-app/esp32/sdkconfig_devkit.defaults diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index 83cb08898b0467..9bb9dde55f47a1 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -61,8 +61,16 @@ jobs: .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - name: Build example All Clusters App - timeout-minutes: 25 - run: scripts/examples/esp_example.sh all-clusters-app + timeout-minutes: 10 + run: scripts/examples/esp_example.sh all-clusters-app sdkconfig_m5stack.defaults + - name: Copy aside build products + run: | + mkdir -p example_binaries/$BUILD_TYPE-build + cp examples/all-clusters-app/esp32/build/chip-all-clusters-app.elf \ + example_binaries/$BUILD_TYPE-build/chip-all-clusters-app.elf + - name: Build example All Clusters App C3 + timeout-minutes: 10 + run: scripts/examples/esp_example.sh all-clusters-app sdkconfig_c3devkit.defaults - name: Copy aside build products run: | mkdir -p example_binaries/$BUILD_TYPE-build @@ -70,7 +78,7 @@ jobs: example_binaries/$BUILD_TYPE-build/chip-all-clusters-app.elf - name: Build example Pigweed App timeout-minutes: 5 - run: scripts/examples/esp_example.sh pigweed-app + run: scripts/examples/esp_example.sh pigweed-app sdkconfig.defaults - name: Copy aside build products run: | mkdir -p example_binaries/$BUILD_TYPE-build @@ -78,7 +86,7 @@ jobs: example_binaries/$BUILD_TYPE-build/chip-pigweed-app.elf - name: Build example Lock App timeout-minutes: 5 - run: scripts/examples/esp_example.sh lock-app + run: scripts/examples/esp_example.sh lock-app sdkconfig.defaults - name: Copy aside build products run: | mkdir -p example_binaries/$BUILD_TYPE-build @@ -86,7 +94,7 @@ jobs: example_binaries/$BUILD_TYPE-build/chip-lock-app.elf - name: Build example Persistent Storage App timeout-minutes: 5 - run: scripts/examples/esp_example.sh persistent-storage + run: scripts/examples/esp_example.sh persistent-storage sdkconfig.defaults - name: Copy aside build products run: | mkdir -p example_binaries/$BUILD_TYPE-build @@ -94,20 +102,28 @@ jobs: example_binaries/$BUILD_TYPE-build/chip-persistent-storage.elf - name: Build example Shell App timeout-minutes: 5 - run: scripts/examples/esp_example.sh shell + run: scripts/examples/esp_example.sh shell sdkconfig.defaults - name: Copy aside build products run: | mkdir -p example_binaries/$BUILD_TYPE-build cp examples/shell/esp32/build/chip-shell.elf \ example_binaries/$BUILD_TYPE-build/chip-shell.elf - name: Build example Temperature Measurement App - timeout-minutes: 25 - run: scripts/examples/esp_example.sh temperature-measurement-app + timeout-minutes: 5 + run: scripts/examples/esp_example.sh temperature-measurement-app sdkconfig.optimize.defaults - name: Copy aside build products run: | mkdir -p example_binaries/$BUILD_TYPE-build cp examples/temperature-measurement-app/esp32/build/chip-temperature-measurement-app.elf \ example_binaries/$BUILD_TYPE-build/chip-temperature-measurement-app.elf + - name: Build example IPv6 Only App + timeout-minutes: 5 + run: scripts/examples/esp_example.sh ipv6only-app sdkconfig.defaults + - name: Copy aside build products + run: | + mkdir -p example_binaries/$BUILD_TYPE-build + cp examples/ipv6only-app/esp32/build/chip-ipv6only-app.elf \ + example_binaries/$BUILD_TYPE-build/chip-ipv6only-app.elf - name: Binary artifact suffix id: outsuffix uses: haya14busa/action-cond@v1.0.0 diff --git a/examples/all-clusters-app/esp32/sdkconfig_devkit.defaults b/examples/all-clusters-app/esp32/sdkconfig_devkit.defaults deleted file mode 100644 index 0586571d64f5cd..00000000000000 --- a/examples/all-clusters-app/esp32/sdkconfig_devkit.defaults +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (c) 2020 Project CHIP Authors -# Copyright (c) 2018 Nest Labs, Inc. -# All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Description: -# CI uses this to select the ESP32-DevKitC. -# -CONFIG_IDF_TARGET="esp32" -CONFIG_IDF_TARGET_ESP32=y -CONFIG_DEVICE_TYPE_ESP32_DEVKITC=y - -# Default to 921600 baud when flashing and monitoring device -CONFIG_ESPTOOLPY_BAUD_921600B=y -CONFIG_ESPTOOLPY_BAUD=921600 -CONFIG_ESPTOOLPY_COMPRESSED=y -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 - -#enable BT -CONFIG_BT_ENABLED=y -CONFIG_BT_NIMBLE_ENABLED=y - -#enable lwip ipv6 autoconfig -CONFIG_LWIP_IPV6_AUTOCONFIG=y - -# Use a custom partition table -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" - -# Main task needs a bit more stack than the default -# default is 3584, bump this up to 4k. -CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 - diff --git a/examples/temperature-measurement-app/esp32/sdkconfig_devkit.defaults b/examples/temperature-measurement-app/esp32/sdkconfig_devkit.defaults deleted file mode 100644 index e2062b2796a175..00000000000000 --- a/examples/temperature-measurement-app/esp32/sdkconfig_devkit.defaults +++ /dev/null @@ -1,71 +0,0 @@ -# -# Copyright (c) 2020 Project CHIP Authors -# Copyright (c) 2018 Nest Labs, Inc. -# All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Description: -# CI uses this to select the ESP32-DevKitC. -# - -CONFIG_DEVICE_TYPE_ESP32_DEVKITC=y - -# Default to 921600 baud when flashing and monitoring device -CONFIG_ESPTOOLPY_BAUD_921600B=y -CONFIG_ESPTOOLPY_BAUD=921600 -CONFIG_ESPTOOLPY_COMPRESSED=y -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 - -#enable BT -CONFIG_BT_ENABLED=y -CONFIG_BT_NIMBLE_ENABLED=y - -#enable lwip ipv6 autoconfig -CONFIG_LWIP_IPV6_AUTOCONFIG=y - -# Use a custom partition table -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" - -# Compiler options -CONFIG_COMPILER_OPTIMIZATION_SIZE=y - -# Bluetooth controller -CONFIG_BTDM_CTRL_BLE_MAX_CONN=1 -CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=1 - -# NimBLE Options -CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 - -# Wi-Fi -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 - -# FreeRTOS -CONFIG_FREERTOS_UNICORE=y - -# LWIP -CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=16 - -# TCP -CONFIG_LWIP_TCP_SYNMAXRTX=6 - -# Compatibility options -CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=1 -CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=1 -CONFIG_NIMBLE_MAX_CONNECTIONS=1 -CONFIG_TCPIP_RECVMBOX_SIZE=16 -CONFIG_TCP_SYNMAXRTX=6 diff --git a/scripts/build/builders/esp32.py b/scripts/build/builders/esp32.py index d56e9abb0830d2..26fd34beabb240 100644 --- a/scripts/build/builders/esp32.py +++ b/scripts/build/builders/esp32.py @@ -41,7 +41,7 @@ def DefaultsFileName(board: Esp32Board, app: Esp32App): return None if board == Esp32Board.DevKitC: - return 'sdkconfig_devkit.defaults' + return 'sdkconfig.defaults' elif board == Esp32Board.M5Stack: return 'sdkconfig_m5stack.defaults' else: diff --git a/scripts/examples/esp_example.sh b/scripts/examples/esp_example.sh index 429fdcd4906164..a4ab58f922982b 100755 --- a/scripts/examples/esp_example.sh +++ b/scripts/examples/esp_example.sh @@ -20,6 +20,7 @@ set -x env app="$1" +sdkconfig_name="$2" root=examples/$app/esp32/ shift 1 @@ -33,23 +34,19 @@ source "scripts/activate.sh" # shellcheck source=/dev/null source "$IDF_PATH/export.sh" -for sdkconfig in "$root"/sdkconfig*.defaults; do - # remove root path to get sdkconfig*.defaults name - sdkconfig_name=${sdkconfig#"$root"/} - if [ "$sdkconfig_name" == "sdkconfig_c3devkit.defaults" ]; then - idf_target="esp32c3" - else - idf_target="esp32" - fi - - rm -f "$root"/sdkconfig - ( - cd "$root" - idf.py set-target "$idf_target" - idf.py -D SDKCONFIG_DEFAULTS="$sdkconfig_name" build - ) || { - echo "build $sdkconfig_name failed" - exit 1 - } - cp "$root"/build/chip-"$app".elf "$root"/build/"${sdkconfig_name%".defaults"}"-chip-"$app".elf -done +if [ "$sdkconfig_name" == "sdkconfig_c3devkit.defaults" ]; then + idf_target="esp32c3" +else + idf_target="esp32" +fi + +rm -f "$root"/sdkconfig +( + cd "$root" + idf.py set-target "$idf_target" + idf.py -D SDKCONFIG_DEFAULTS="$sdkconfig_name" build +) || { + echo "build $sdkconfig_name failed" + exit 1 +} +cp "$root"/build/chip-"$app".elf "$root"/build/"${sdkconfig_name%".defaults"}"-chip-"$app".elf