Skip to content

Commit

Permalink
[ESP32] Update esp-idf to v5.1 release (#28326)
Browse files Browse the repository at this point in the history
* [ESP32] Update esp-idf to v5.1 release

* Fix the requirements for v5.1

* Fix the pyparsing version and explaining comment

* Update the container image to use the latest one

* remove gdbgui from few more places

* fixup constraints for pyparsing

* Fix kconfig module

* Fix the esp32 qemu

* Fix freertos path

* Fix format specifier in esp32 pigweed logger

* Restyled by clang-format

* Fix the shell app

* Move freertos function from IRAM to flash for chef app

* Fixes for building all-clusters-app with Target m5stack.

Also, IRAM usage shot up so moved the freertos functions to flash

* Changes to fix all-clusters-minimal app

* Remove gdbgui references

* Changes in lighting-app

* Examples supporting display must build for non esp32 targets

* Pull in few dram optimizations from temperature app

* Reduce the critical logging buffer

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
shubhamdp and restyled-commits authored Aug 1, 2023
1 parent e059202 commit 4ac9304
Show file tree
Hide file tree
Showing 34 changed files with 143 additions and 125 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/chef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-esp32:1
image: ghcr.io/project-chip/chip-build-esp32:2
options: --user root

steps:
Expand All @@ -64,8 +64,6 @@ jobs:
uses: ./.github/actions/checkout-submodules-and-bootstrap
with:
platform: esp32
- name: Fixup GdbGui requirement
run: perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt
- name: CI Examples ESP32
shell: bash
run: |
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/examples-esp32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-esp32:1
image: ghcr.io/project-chip/chip-build-esp32:2
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"

Expand All @@ -46,9 +46,6 @@ jobs:
with:
platform: esp32

- name: Fixup GdbGui requirement
run: perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt

- name: Set up environment for size reports
uses: ./.github/actions/setup-size-reports
if: ${{ !env.ACT }}
Expand Down Expand Up @@ -130,7 +127,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-esp32:1
image: ghcr.io/project-chip/chip-build-esp32:2
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"

Expand All @@ -142,9 +139,6 @@ jobs:
with:
platform: esp32

- name: Fixup GdbGui requirement
run: perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt

- name: Build example Bridge App
run: scripts/examples/esp_example.sh bridge-app

Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/qemu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-esp32-qemu:1
image: ghcr.io/project-chip/chip-build-esp32-qemu:2
volumes:
- "/tmp/log_output:/tmp/test_logs"

Expand All @@ -50,9 +50,6 @@ jobs:
with:
platform: esp32

- name: Fixup GdbGui requirement
run: perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt

- name: Build ESP32 QEMU test images
run: |
scripts/run_in_build_env.sh " \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-latest

container:
image: ghcr.io/project-chip/chip-build-esp32:1
image: ghcr.io/project-chip/chip-build-esp32:2

steps:
- name: Checkout
Expand Down
25 changes: 5 additions & 20 deletions config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -462,26 +462,11 @@ foreach(phy_blob ${phy_blobs})
list(APPEND chip_libraries "${esp_phy_dir}/lib/${target_name}/lib${phy_blob}.a")
endforeach()

idf_component_get_property(esp_event_lib esp_event COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${esp_event_lib}>)

idf_component_get_property(hal_lib hal COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${hal_lib}>)

idf_component_get_property(esp_system_lib esp_system COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${esp_system_lib}>)

idf_component_get_property(soc_lib soc COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${soc_lib}>)

idf_component_get_property(efuse_lib efuse COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${efuse_lib}>)

idf_component_get_property(vfs_lib vfs COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${vfs_lib}>)

idf_component_get_property(driver_lib driver COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${driver_lib}>)
set(components_to_link esp_event hal esp_system soc efuse vfs driver esp_coex freertos)
foreach(component ${components_to_link})
idf_component_get_property(lib_name ${component} COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${lib_name}>)
endforeach()

target_link_libraries(${COMPONENT_LIB} INTERFACE -Wl,--start-group
${chip_libraries}
Expand Down
42 changes: 8 additions & 34 deletions docs/guides/esp32/setup_idf_chip.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,32 @@ step.

### Install Prerequisites

- [Linux](https://docs.espressif.com/projects/esp-idf/en/v4.4.4/esp32/get-started/linux-setup.html)
- [macOS](https://docs.espressif.com/projects/esp-idf/en/v4.4.4/esp32/get-started/macos-setup.html)
- [Linux](https://docs.espressif.com/projects/esp-idf/en/v5.1/esp32/get-started/linux-macos-setup.html#for-linux-users)
- [macOS](https://docs.espressif.com/projects/esp-idf/en/v5.1/esp32/get-started/linux-macos-setup.html#for-macos-users)

### Get IDF v4.4.4
### Get IDF v5.1

- Clone ESP-IDF
[v4.4.4 release](https://github.com/espressif/esp-idf/releases/tag/v4.4.4)
[v5.1 release](https://github.com/espressif/esp-idf/releases/tag/v5.1)

```
$ git clone -b v4.4.4 --recursive https://github.com/espressif/esp-idf.git
$ git clone -b v5.1 --recursive --depth 1 --shallow-submodule https://github.com/espressif/esp-idf.git
$ cd esp-idf
$ ./install.sh
```
- To update an existing esp-idf toolchain to v4.4.4:
- To update an existing esp-idf toolchain to v5.1:
```
$ cd path/to/esp-idf
$ git fetch origin
$ git checkout v4.4.4
$ git reset --hard origin/v4.4.4
$ git checkout v5.1
$ git reset --hard origin/v5.1
$ git submodule update --recursive --init
$ git clean -fdx
$ ./install.sh
```
- For ESP32C6 & ESP32H2, please use commit
[ea5e0ff](https://github.com/espressif/esp-idf/tree/ea5e0ff).
```
$ cd esp-idf
$ git checkout ea5e0ff
$ git submodule update --init
$ ./install.sh
```
## Setup Matter environment
### Install Prerequisites
Expand Down Expand Up @@ -80,22 +70,6 @@ below:
python3 -m pip install esptool
```
For MacOS, `gdbgui` python package will not be installed using `bootstrap.sh`
script as it is restricted only for x64 Linux platforms. It is restricted
because, building wheels for `gevent` (dependency of `gdbgui`) fails on MacOS.
For ARM-based Mac, no further installation steps are necessary if Python3
version is greater than or equal to 3.11.
If Python3 version is less than 3.11 or you are using x86(Intel-based) Mac then
please run the below commands after every bootstrapping to install gdbgui wheels
as binary
```
python3 -m pip install -c scripts/setup/constraints.txt --no-cache --prefer-binary gdbgui==0.13.2.0
deactivate
```
---
Once IDF and Matter environment is set up, head over to
Expand Down
7 changes: 3 additions & 4 deletions examples/all-clusters-app/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/cm

set(EXTRA_COMPONENT_DIRS
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components"
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/QRCode"
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common"
)

if(${IDF_TARGET} STREQUAL "esp32")
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components/tft"
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components/spidriver"
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/screen-framework")
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components")
endif()

project(chip-all-clusters-app)
Expand Down
15 changes: 11 additions & 4 deletions examples/all-clusters-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,25 @@ set(PRIV_INCLUDE_DIRS_LIST "${PRIV_INCLUDE_DIRS_LIST}"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/lib/support"
"${IDF_PATH}/components/freertos/include/freertos"
)

if (${IDF_VERSION_MAJOR} LESS 5)
list(APPEND PRIV_INCLUDE_DIRS_LIST "${IDF_PATH}/components/freertos/include/freertos")
else()
list(APPEND PRIV_INCLUDE_DIRS_LIST "${IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
endif()

set(SRC_DIRS_LIST "${SRC_DIRS_LIST}"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32"
)
endif (CONFIG_ENABLE_PW_RPC)

set(PRIV_REQUIRES_LIST chip QRCode bt driver app_update nvs_flash spi_flash openthread)
if(CONFIG_HAVE_DISPLAY)
list(APPEND PRIV_REQUIRES_LIST tft spidrier screen-framework)
set(PRIV_REQUIRES_LIST chip QRCode bt app_update nvs_flash spi_flash openthread)

if(${IDF_TARGET} STREQUAL "esp32")
list(APPEND PRIV_REQUIRES_LIST spidriver screen-framework)
endif()

if(CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM)
Expand Down
3 changes: 3 additions & 0 deletions examples/all-clusters-app/esp32/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ CONFIG_MBEDTLS_HKDF_C=y
# This example uses the older version of RMT driver to work with both
# idf-v4.4.3 and idf-v5.0, so supressing the warnings by setting below option
CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y

# Move functions from IRAM to flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
3 changes: 3 additions & 0 deletions examples/all-clusters-app/esp32/sdkconfig_c3devkit.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ CONFIG_ESPTOOLPY_FLASHSIZE="4MB"

# Enable HKDF in mbedtls
CONFIG_MBEDTLS_HKDF_C=y

# Move functions from IRAM to flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
3 changes: 3 additions & 0 deletions examples/all-clusters-app/esp32/sdkconfig_m5stack.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ CONFIG_MBEDTLS_HKDF_C=y

# Build chip tests
CONFIG_BUILD_CHIP_TESTS=y

# Move functions from IRAM to flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,9 @@ CONFIG_MBEDTLS_HKDF_C=y

# Build chip tests
CONFIG_BUILD_CHIP_TESTS=y

# Move functions from IRAM to flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

# to avoid dram overflow, reduce the critical loggin buffer to 1K
CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE=1024
7 changes: 3 additions & 4 deletions examples/all-clusters-minimal-app/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/cm

set(EXTRA_COMPONENT_DIRS
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components"
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/QRCode"
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common"
)

if(${IDF_TARGET} STREQUAL "esp32")
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components/tft"
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components/spidriver"
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/screen-framework")
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components")
endif()

project(chip-all-clusters-minimal-app)
Expand Down
13 changes: 10 additions & 3 deletions examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ set(PRIV_INCLUDE_DIRS_LIST "${PRIV_INCLUDE_DIRS_LIST}"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/lib/support"
"${IDF_PATH}/components/freertos/include/freertos"
)

if (${IDF_VERSION_MAJOR} LESS 5)
list(APPEND PRIV_INCLUDE_DIRS_LIST "${IDF_PATH}/components/freertos/include/freertos")
else()
list(APPEND PRIV_INCLUDE_DIRS_LIST "${IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
endif()

set(SRC_DIRS_LIST "${SRC_DIRS_LIST}"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed"
Expand All @@ -110,8 +116,9 @@ set(SRC_DIRS_LIST "${SRC_DIRS_LIST}"
endif (CONFIG_ENABLE_PW_RPC)

set(PRIV_REQUIRES_LIST chip QRCode bt driver app_update nvs_flash spi_flash openthread)
if(CONFIG_HAVE_DISPLAY)
list(APPEND PRIV_REQUIRES_LIST tft spidrier screen-framework)

if(${IDF_TARGET} STREQUAL "esp32")
list(APPEND PRIV_REQUIRES_LIST spidriver screen-framework)
endif()

if(CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM)
Expand Down
4 changes: 2 additions & 2 deletions examples/all-clusters-minimal-app/esp32/partitions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
nvs, data, nvs, , 0xC000,
otadata, data, ota, , 0x2000,
phy_init, data, phy, , 0x1000,
ota_0, app, ota_0, , 1500K,
ota_1, app, ota_1, , 1500K,
ota_0, app, ota_0, , 1900K,
ota_1, app, ota_1, , 1900K,
ot_storage, data, 0x3a, , 0x2000,
3 changes: 3 additions & 0 deletions examples/all-clusters-minimal-app/esp32/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y

# Enable HKDF in mbedtls
CONFIG_MBEDTLS_HKDF_C=y

# Move functions from IRAM to flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ CONFIG_ESPTOOLPY_FLASHSIZE="4MB"

# Enable HKDF in mbedtls
CONFIG_MBEDTLS_HKDF_C=y

# Move functions from IRAM to flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ CONFIG_MBEDTLS_HKDF_C=y

# Build chip tests
CONFIG_BUILD_CHIP_TESTS=y

# Move functions from IRAM to flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,9 @@ CONFIG_MBEDTLS_HKDF_C=y

# Build chip tests
CONFIG_BUILD_CHIP_TESTS=y

# Move functions from IRAM to flash
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

# to avoid dram overflow, reduce the critical loggin buffer to 1K
CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE=1024
3 changes: 3 additions & 0 deletions examples/chef/esp32/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n

# Enable HKDF in mbedtls
CONFIG_MBEDTLS_HKDF_C=y

# IRAM optimizations
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
3 changes: 3 additions & 0 deletions examples/chef/esp32/sdkconfig_rpc.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ CONFIG_ESPTOOLPY_FLASHSIZE="4MB"

# Enable HKDF in mbedtls
CONFIG_MBEDTLS_HKDF_C=y

# IRAM optimizations
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
8 changes: 7 additions & 1 deletion examples/common/screen-framework/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
set(require_list chip driver)

if(${IDF_TARGET} STREQUAL "esp32")
list(APPEND require_list tft)
endif()

idf_component_register(SRCS "Display.cpp"
"ScreenManager.cpp"
"Screen.cpp"
"ListScreen.cpp"
INCLUDE_DIRS "include"
PRIV_REQUIRES tft chip driver)
REQUIRES ${require_list})
Loading

0 comments on commit 4ac9304

Please sign in to comment.