Skip to content

Commit 4ac9304

Browse files
[ESP32] Update esp-idf to v5.1 release (#28326)
* [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 <commits@restyled.io>
1 parent e059202 commit 4ac9304

File tree

34 files changed

+143
-125
lines changed

34 files changed

+143
-125
lines changed

.github/workflows/chef.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
if: github.actor != 'restyled-io[bot]'
5555

5656
container:
57-
image: ghcr.io/project-chip/chip-build-esp32:1
57+
image: ghcr.io/project-chip/chip-build-esp32:2
5858
options: --user root
5959

6060
steps:
@@ -64,8 +64,6 @@ jobs:
6464
uses: ./.github/actions/checkout-submodules-and-bootstrap
6565
with:
6666
platform: esp32
67-
- name: Fixup GdbGui requirement
68-
run: perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt
6967
- name: CI Examples ESP32
7068
shell: bash
7169
run: |

.github/workflows/examples-esp32.yaml

+2-8
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
if: github.actor != 'restyled-io[bot]'
3535

3636
container:
37-
image: ghcr.io/project-chip/chip-build-esp32:1
37+
image: ghcr.io/project-chip/chip-build-esp32:2
3838
volumes:
3939
- "/tmp/bloat_reports:/tmp/bloat_reports"
4040

@@ -46,9 +46,6 @@ jobs:
4646
with:
4747
platform: esp32
4848

49-
- name: Fixup GdbGui requirement
50-
run: perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt
51-
5249
- name: Set up environment for size reports
5350
uses: ./.github/actions/setup-size-reports
5451
if: ${{ !env.ACT }}
@@ -130,7 +127,7 @@ jobs:
130127
if: github.actor != 'restyled-io[bot]'
131128

132129
container:
133-
image: ghcr.io/project-chip/chip-build-esp32:1
130+
image: ghcr.io/project-chip/chip-build-esp32:2
134131
volumes:
135132
- "/tmp/bloat_reports:/tmp/bloat_reports"
136133

@@ -142,9 +139,6 @@ jobs:
142139
with:
143140
platform: esp32
144141

145-
- name: Fixup GdbGui requirement
146-
run: perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt
147-
148142
- name: Build example Bridge App
149143
run: scripts/examples/esp_example.sh bridge-app
150144

.github/workflows/qemu.yaml

+1-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
if: github.actor != 'restyled-io[bot]'
3939

4040
container:
41-
image: ghcr.io/project-chip/chip-build-esp32-qemu:1
41+
image: ghcr.io/project-chip/chip-build-esp32-qemu:2
4242
volumes:
4343
- "/tmp/log_output:/tmp/test_logs"
4444

@@ -50,9 +50,6 @@ jobs:
5050
with:
5151
platform: esp32
5252

53-
- name: Fixup GdbGui requirement
54-
run: perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt
55-
5653
- name: Build ESP32 QEMU test images
5754
run: |
5855
scripts/run_in_build_env.sh " \

.github/workflows/release_artifacts.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
runs-on: ubuntu-latest
3333

3434
container:
35-
image: ghcr.io/project-chip/chip-build-esp32:1
35+
image: ghcr.io/project-chip/chip-build-esp32:2
3636

3737
steps:
3838
- name: Checkout

config/esp32/components/chip/CMakeLists.txt

+5-20
Original file line numberDiff line numberDiff line change
@@ -462,26 +462,11 @@ foreach(phy_blob ${phy_blobs})
462462
list(APPEND chip_libraries "${esp_phy_dir}/lib/${target_name}/lib${phy_blob}.a")
463463
endforeach()
464464

465-
idf_component_get_property(esp_event_lib esp_event COMPONENT_LIB)
466-
list(APPEND chip_libraries $<TARGET_FILE:${esp_event_lib}>)
467-
468-
idf_component_get_property(hal_lib hal COMPONENT_LIB)
469-
list(APPEND chip_libraries $<TARGET_FILE:${hal_lib}>)
470-
471-
idf_component_get_property(esp_system_lib esp_system COMPONENT_LIB)
472-
list(APPEND chip_libraries $<TARGET_FILE:${esp_system_lib}>)
473-
474-
idf_component_get_property(soc_lib soc COMPONENT_LIB)
475-
list(APPEND chip_libraries $<TARGET_FILE:${soc_lib}>)
476-
477-
idf_component_get_property(efuse_lib efuse COMPONENT_LIB)
478-
list(APPEND chip_libraries $<TARGET_FILE:${efuse_lib}>)
479-
480-
idf_component_get_property(vfs_lib vfs COMPONENT_LIB)
481-
list(APPEND chip_libraries $<TARGET_FILE:${vfs_lib}>)
482-
483-
idf_component_get_property(driver_lib driver COMPONENT_LIB)
484-
list(APPEND chip_libraries $<TARGET_FILE:${driver_lib}>)
465+
set(components_to_link esp_event hal esp_system soc efuse vfs driver esp_coex freertos)
466+
foreach(component ${components_to_link})
467+
idf_component_get_property(lib_name ${component} COMPONENT_LIB)
468+
list(APPEND chip_libraries $<TARGET_FILE:${lib_name}>)
469+
endforeach()
485470

486471
target_link_libraries(${COMPONENT_LIB} INTERFACE -Wl,--start-group
487472
${chip_libraries}

docs/guides/esp32/setup_idf_chip.md

+8-34
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,32 @@ step.
1313

1414
### Install Prerequisites
1515

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

19-
### Get IDF v4.4.4
19+
### Get IDF v5.1
2020

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

2424
```
25-
$ git clone -b v4.4.4 --recursive https://github.com/espressif/esp-idf.git
25+
$ git clone -b v5.1 --recursive --depth 1 --shallow-submodule https://github.com/espressif/esp-idf.git
2626
$ cd esp-idf
2727
$ ./install.sh
2828
```
2929
30-
- To update an existing esp-idf toolchain to v4.4.4:
30+
- To update an existing esp-idf toolchain to v5.1:
3131
3232
```
3333
$ cd path/to/esp-idf
3434
$ git fetch origin
35-
$ git checkout v4.4.4
36-
$ git reset --hard origin/v4.4.4
35+
$ git checkout v5.1
36+
$ git reset --hard origin/v5.1
3737
$ git submodule update --recursive --init
3838
$ git clean -fdx
3939
$ ./install.sh
4040
```
4141
42-
- For ESP32C6 & ESP32H2, please use commit
43-
[ea5e0ff](https://github.com/espressif/esp-idf/tree/ea5e0ff).
44-
45-
```
46-
$ cd esp-idf
47-
$ git checkout ea5e0ff
48-
$ git submodule update --init
49-
$ ./install.sh
50-
```
51-
5242
## Setup Matter environment
5343
5444
### Install Prerequisites
@@ -80,22 +70,6 @@ below:
8070
python3 -m pip install esptool
8171
```
8272
83-
For MacOS, `gdbgui` python package will not be installed using `bootstrap.sh`
84-
script as it is restricted only for x64 Linux platforms. It is restricted
85-
because, building wheels for `gevent` (dependency of `gdbgui`) fails on MacOS.
86-
87-
For ARM-based Mac, no further installation steps are necessary if Python3
88-
version is greater than or equal to 3.11.
89-
90-
If Python3 version is less than 3.11 or you are using x86(Intel-based) Mac then
91-
please run the below commands after every bootstrapping to install gdbgui wheels
92-
as binary
93-
94-
```
95-
python3 -m pip install -c scripts/setup/constraints.txt --no-cache --prefer-binary gdbgui==0.13.2.0
96-
deactivate
97-
```
98-
9973
---
10074
10175
Once IDF and Matter environment is set up, head over to

examples/all-clusters-app/esp32/CMakeLists.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/cm
2626

2727
set(EXTRA_COMPONENT_DIRS
2828
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components"
29-
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/QRCode"
29+
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common"
3030
)
31+
3132
if(${IDF_TARGET} STREQUAL "esp32")
32-
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components/tft"
33-
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components/spidriver"
34-
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/screen-framework")
33+
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components")
3534
endif()
3635

3736
project(chip-all-clusters-app)

examples/all-clusters-app/esp32/main/CMakeLists.txt

+11-4
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,25 @@ set(PRIV_INCLUDE_DIRS_LIST "${PRIV_INCLUDE_DIRS_LIST}"
110110
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed"
111111
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32"
112112
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/lib/support"
113-
"${IDF_PATH}/components/freertos/include/freertos"
114113
)
114+
115+
if (${IDF_VERSION_MAJOR} LESS 5)
116+
list(APPEND PRIV_INCLUDE_DIRS_LIST "${IDF_PATH}/components/freertos/include/freertos")
117+
else()
118+
list(APPEND PRIV_INCLUDE_DIRS_LIST "${IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
119+
endif()
120+
115121
set(SRC_DIRS_LIST "${SRC_DIRS_LIST}"
116122
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32"
117123
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed"
118124
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32"
119125
)
120126
endif (CONFIG_ENABLE_PW_RPC)
121127

122-
set(PRIV_REQUIRES_LIST chip QRCode bt driver app_update nvs_flash spi_flash openthread)
123-
if(CONFIG_HAVE_DISPLAY)
124-
list(APPEND PRIV_REQUIRES_LIST tft spidrier screen-framework)
128+
set(PRIV_REQUIRES_LIST chip QRCode bt app_update nvs_flash spi_flash openthread)
129+
130+
if(${IDF_TARGET} STREQUAL "esp32")
131+
list(APPEND PRIV_REQUIRES_LIST spidriver screen-framework)
125132
endif()
126133

127134
if(CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM)

examples/all-clusters-app/esp32/sdkconfig.defaults

+3
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,6 @@ CONFIG_MBEDTLS_HKDF_C=y
6666
# This example uses the older version of RMT driver to work with both
6767
# idf-v4.4.3 and idf-v5.0, so supressing the warnings by setting below option
6868
CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y
69+
70+
# Move functions from IRAM to flash
71+
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

examples/all-clusters-app/esp32/sdkconfig_c3devkit.defaults

+3
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
5050

5151
# Enable HKDF in mbedtls
5252
CONFIG_MBEDTLS_HKDF_C=y
53+
54+
# Move functions from IRAM to flash
55+
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

examples/all-clusters-app/esp32/sdkconfig_m5stack.defaults

+3
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ CONFIG_MBEDTLS_HKDF_C=y
7070

7171
# Build chip tests
7272
CONFIG_BUILD_CHIP_TESTS=y
73+
74+
# Move functions from IRAM to flash
75+
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

examples/all-clusters-app/esp32/sdkconfig_m5stack_rpc.defaults

+6
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,9 @@ CONFIG_MBEDTLS_HKDF_C=y
7474

7575
# Build chip tests
7676
CONFIG_BUILD_CHIP_TESTS=y
77+
78+
# Move functions from IRAM to flash
79+
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
80+
81+
# to avoid dram overflow, reduce the critical loggin buffer to 1K
82+
CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE=1024

examples/all-clusters-minimal-app/esp32/CMakeLists.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/cm
2626

2727
set(EXTRA_COMPONENT_DIRS
2828
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components"
29-
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/QRCode"
29+
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common"
3030
)
31+
3132
if(${IDF_TARGET} STREQUAL "esp32")
32-
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components/tft"
33-
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components/spidriver"
34-
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/screen-framework")
33+
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/examples/common/m5stack-tft/repo/components")
3534
endif()
3635

3736
project(chip-all-clusters-minimal-app)

examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt

+10-3
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,14 @@ set(PRIV_INCLUDE_DIRS_LIST "${PRIV_INCLUDE_DIRS_LIST}"
100100
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed"
101101
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32"
102102
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/lib/support"
103-
"${IDF_PATH}/components/freertos/include/freertos"
104103
)
104+
105+
if (${IDF_VERSION_MAJOR} LESS 5)
106+
list(APPEND PRIV_INCLUDE_DIRS_LIST "${IDF_PATH}/components/freertos/include/freertos")
107+
else()
108+
list(APPEND PRIV_INCLUDE_DIRS_LIST "${IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
109+
endif()
110+
105111
set(SRC_DIRS_LIST "${SRC_DIRS_LIST}"
106112
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32"
107113
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed"
@@ -110,8 +116,9 @@ set(SRC_DIRS_LIST "${SRC_DIRS_LIST}"
110116
endif (CONFIG_ENABLE_PW_RPC)
111117

112118
set(PRIV_REQUIRES_LIST chip QRCode bt driver app_update nvs_flash spi_flash openthread)
113-
if(CONFIG_HAVE_DISPLAY)
114-
list(APPEND PRIV_REQUIRES_LIST tft spidrier screen-framework)
119+
120+
if(${IDF_TARGET} STREQUAL "esp32")
121+
list(APPEND PRIV_REQUIRES_LIST spidriver screen-framework)
115122
endif()
116123

117124
if(CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM)

examples/all-clusters-minimal-app/esp32/partitions.csv

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
nvs, data, nvs, , 0xC000,
44
otadata, data, ota, , 0x2000,
55
phy_init, data, phy, , 0x1000,
6-
ota_0, app, ota_0, , 1500K,
7-
ota_1, app, ota_1, , 1500K,
6+
ota_0, app, ota_0, , 1900K,
7+
ota_1, app, ota_1, , 1900K,
88
ot_storage, data, 0x3a, , 0x2000,

examples/all-clusters-minimal-app/esp32/sdkconfig.defaults

+3
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,6 @@ CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y
6666

6767
# Enable HKDF in mbedtls
6868
CONFIG_MBEDTLS_HKDF_C=y
69+
70+
# Move functions from IRAM to flash
71+
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

examples/all-clusters-minimal-app/esp32/sdkconfig_c3devkit.defaults

+3
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
5050

5151
# Enable HKDF in mbedtls
5252
CONFIG_MBEDTLS_HKDF_C=y
53+
54+
# Move functions from IRAM to flash
55+
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

examples/all-clusters-minimal-app/esp32/sdkconfig_m5stack.defaults

+3
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ CONFIG_MBEDTLS_HKDF_C=y
7070

7171
# Build chip tests
7272
CONFIG_BUILD_CHIP_TESTS=y
73+
74+
# Move functions from IRAM to flash
75+
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

examples/all-clusters-minimal-app/esp32/sdkconfig_m5stack_rpc.defaults

+6
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,9 @@ CONFIG_MBEDTLS_HKDF_C=y
7474

7575
# Build chip tests
7676
CONFIG_BUILD_CHIP_TESTS=y
77+
78+
# Move functions from IRAM to flash
79+
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
80+
81+
# to avoid dram overflow, reduce the critical loggin buffer to 1K
82+
CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE=1024

examples/chef/esp32/sdkconfig.defaults

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n
5959

6060
# Enable HKDF in mbedtls
6161
CONFIG_MBEDTLS_HKDF_C=y
62+
63+
# IRAM optimizations
64+
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y

examples/chef/esp32/sdkconfig_rpc.defaults

+3
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
5858

5959
# Enable HKDF in mbedtls
6060
CONFIG_MBEDTLS_HKDF_C=y
61+
62+
# IRAM optimizations
63+
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
set(require_list chip driver)
2+
3+
if(${IDF_TARGET} STREQUAL "esp32")
4+
list(APPEND require_list tft)
5+
endif()
6+
17
idf_component_register(SRCS "Display.cpp"
28
"ScreenManager.cpp"
39
"Screen.cpp"
410
"ListScreen.cpp"
511
INCLUDE_DIRS "include"
6-
PRIV_REQUIRES tft chip driver)
12+
REQUIRES ${require_list})

0 commit comments

Comments
 (0)