From 26fa994a22354b1aad8f101144d71e54b9ffb7cc Mon Sep 17 00:00:00 2001 From: noyceone0630 Date: Wed, 28 Apr 2021 20:10:02 +0800 Subject: [PATCH] update idf version to tag v4.3 and support esp32c3 for all-clusters-app --- config/esp32/components/chip/CMakeLists.txt | 1 + config/esp32/components/chip/component.mk | 1 + .../all-clusters-app/esp32/CMakeLists.txt | 10 ++++-- examples/all-clusters-app/esp32/README.md | 36 ++++++++++++------- .../esp32/main/CMakeLists.txt | 20 +++++++++-- .../esp32/main/Kconfig.projbuild | 7 ++++ examples/all-clusters-app/esp32/main/main.cpp | 4 +++ examples/lock-app/esp32/CMakeLists.txt | 5 +-- examples/lock-app/esp32/README.md | 5 +-- .../persistent-storage/esp32/CMakeLists.txt | 2 +- examples/persistent-storage/esp32/README.md | 5 +-- examples/pigweed-app/esp32/CMakeLists.txt | 2 +- examples/pigweed-app/esp32/README.md | 5 +-- examples/shell/esp32/main/CMakeLists.txt | 2 +- .../esp32/CMakeLists.txt | 5 +-- .../esp32/README.md | 5 +-- .../docker/images/chip-build-esp32/Dockerfile | 3 +- scripts/constraints.txt | 2 +- scripts/requirements.esp32.txt | 3 ++ src/lib/core/CHIPTLV.h | 10 ++++++ src/lib/core/CHIPTLVWriter.cpp | 12 +++++++ src/platform/ESP32/PlatformManagerImpl.cpp | 2 +- src/platform/ESP32/nimble/BLEManagerImpl.cpp | 7 +++- src/test_driver/esp32/README.md | 5 +-- 24 files changed, 119 insertions(+), 40 deletions(-) diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt index f209c37779acaa..a21676f484aba5 100644 --- a/config/esp32/components/chip/CMakeLists.txt +++ b/config/esp32/components/chip/CMakeLists.txt @@ -61,6 +61,7 @@ chip_gn_arg_bool("is_debug" is_debug) if(CONFIG_ENABLE_PW_RPC) string(APPEND chip_gn_args "import(\"//build_overrides/pigweed.gni\")\n") + chip_gn_arg_append("remove_default_configs" "[\"//third_party/connectedhomeip/third_party/pigweed/repo/pw_build:cpp17\"]") chip_gn_arg_append("chip_build_pw_rpc_lib" "true") chip_gn_arg_append("pw_log_BACKEND" "\"//third_party/connectedhomeip/third_party/pigweed/repo/pw_log_basic\"") chip_gn_arg_append("pw_assert_BACKEND" "\"//third_party/connectedhomeip/third_party/pigweed/repo/pw_assert_log\"") diff --git a/config/esp32/components/chip/component.mk b/config/esp32/components/chip/component.mk index bf7cbee1f79dd6..e1c481d5c26047 100644 --- a/config/esp32/components/chip/component.mk +++ b/config/esp32/components/chip/component.mk @@ -134,6 +134,7 @@ ifeq ($(is_debug),false) endif if [[ "$(CONFIG_ENABLE_PW_RPC)" = "y" ]]; then \ echo "chip_build_pw_rpc_lib = true" >> $(OUTPUT_DIR)/args.gn ;\ + echo "remove_default_configs = [\"//third_party/connectedhomeip/third_party/pigweed/repo/pw_build:cpp17\"]" >> $(OUTPUT_DIR)/args.gn ;\ echo "pw_log_BACKEND = \"//third_party/connectedhomeip/third_party/pigweed/repo/pw_log_basic\"" >> $(OUTPUT_DIR)/args.gn ;\ echo "pw_assert_BACKEND = \"//third_party/connectedhomeip/third_party/pigweed/repo/pw_assert_log\"" >> $(OUTPUT_DIR)/args.gn ;\ echo "pw_sys_io_BACKEND = \"//third_party/connectedhomeip/examples/platform/esp32/pw_sys_io:pw_sys_io_esp32\"" >> $(OUTPUT_DIR)/args.gn ;\ diff --git a/examples/all-clusters-app/esp32/CMakeLists.txt b/examples/all-clusters-app/esp32/CMakeLists.txt index 71d0e037c7d661..b60acab5e039a3 100644 --- a/examples/all-clusters-app/esp32/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/CMakeLists.txt @@ -21,11 +21,17 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake) set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components" - "${CMAKE_CURRENT_LIST_DIR}/../../common/m5stack-tft/repo/components" "${CMAKE_CURRENT_LIST_DIR}/../../common/QRCode" +) +if(${IDF_TARGET} STREQUAL "esp32") +set(EXTRA_COMPONENT_DIRS + ${EXTRA_COMPONENT_DIRS} + "${CMAKE_CURRENT_LIST_DIR}/../../common/m5stack-tft/repo/components/tft" + "${CMAKE_CURRENT_LIST_DIR}/../../common/m5stack-tft/repo/components/spidriver" "${CMAKE_CURRENT_LIST_DIR}/../../common/screen-framework" ) +endif() project(chip-all-clusters-app) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=c++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND) diff --git a/examples/all-clusters-app/esp32/README.md b/examples/all-clusters-app/esp32/README.md index 5272c798ea293e..2aabfba557558d 100644 --- a/examples/all-clusters-app/esp32/README.md +++ b/examples/all-clusters-app/esp32/README.md @@ -23,7 +23,8 @@ devices: the [ESP32-DevKitC](https://www.espressif.com/en/products/hardware/esp32-devkitc/overview), the [ESP32-WROVER-KIT_V4.1](https://www.espressif.com/en/products/hardware/esp-wrover-kit/overview), -and the [M5Stack](http://m5stack.com). +the [M5Stack](http://m5stack.com), and the +[ESP32C3-DevKitM](https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html). Note: M5Stack Core 2 display is not supported in the tft component, while other functionality can still work fine. @@ -31,18 +32,20 @@ functionality can still work fine. ## Building the Example Application Building the example application requires the use of the Espressif ESP32 IoT -Development Framework and the xtensa-esp32-elf toolchain. +Development Framework and the xtensa-esp32-elf toolchain for ESP32 modules or +the riscv-esp32-elf toolchain for ESP32C3 modules. The VSCode devcontainer has these components pre-installed, so you can skip this step. To install these components manually, follow these steps: -- Clone the Espressif ESP-IDF and checkout release/v4.2 branch +- Clone the Espressif ESP-IDF and checkout + [v4.3 tag](https://github.com/espressif/esp-idf/releases/v4.3) $ mkdir ${HOME}/tools $ cd ${HOME}/tools $ git clone https://github.com/espressif/esp-idf.git $ cd esp-idf - $ git checkout release/v4.2 + $ git checkout v4.3 $ git submodule update --init $ ./install.sh @@ -69,6 +72,13 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). $ source ./scripts/activate.sh +- Target Set + +To set IDF target, run set-target with one of the commands. + + $ idf.py set-target esp32 + $ idf.py set-target esp32c3 + - Configuration Options To choose from the different configuration options, run menuconfig. @@ -77,7 +87,7 @@ To choose from the different configuration options, run menuconfig. Select ESP32 based `Device Type` through `Demo`->`Device Type`. The device types that are currently supported include `ESP32-DevKitC` (default), -`ESP32-WROVER-KIT_V4.1` and `M5Stack` +`ESP32-WROVER-KIT_V4.1`, `M5Stack` and `ESP32C3-DevKitM`. - To build the demo application. @@ -207,11 +217,11 @@ commissioning and cluster control. ### Note This demo app illustrates controlling OnOff cluster (Server) attributes of an -endpoint. For `ESP32-DevKitC` and `ESP32-WROVER-KIT_V4.1`, a GPIO (configurable -through `STATUS_LED_GPIO_NUM` in `main/main.cpp`) is updated through the -on/off/toggle commands from the `python-controller`. For `M5Stack`, a virtual -Green LED on the display is used for the same. - -If you wish to see the actual effect of the commands on `ESP32-DevKitC` and -`ESP32-WROVER-KIT_V4.1`, you will have to connect an external LED to GPIO -`STATUS_LED_GPIO_NUM`. +endpoint. For `ESP32-DevKitC`, `ESP32-WROVER-KIT_V4.1` and `ESP32C3-DevKitM`, a +GPIO (configurable through `STATUS_LED_GPIO_NUM` in `main/main.cpp`) is updated +through the on/off/toggle commands from the `python-controller`. For `M5Stack`, +a virtual Green LED on the display is used for the same. + +If you wish to see the actual effect of the commands on `ESP32-DevKitC`, +`ESP32-WROVER-KIT_V4.1` and `ESP32C3-DevKitM`, you will have to connect an +external LED to GPIO `STATUS_LED_GPIO_NUM`. diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index ad5424f56c1390..885fb2862c9a50 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -16,13 +16,15 @@ # # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) -idf_component_register(PRIV_INCLUDE_DIRS +# The list of src and include dirs must be in sync with that in all-clusters-app/esp32/main/component.mk +set(PRIV_INCLUDE_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/third_party/nlio/repo/include" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src" "${CMAKE_CURRENT_LIST_DIR}/include" - SRC_DIRS +) +set(SRC_DIRS_LIST "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/gen" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" @@ -62,7 +64,19 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/relative-humidity-measurement-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/pump-configuration-and-control-server" #${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ias-zone-client - PRIV_REQUIRES chip QRCode tft spidriver bt screen-framework) +) + +if(("${CONFIG_DEVICE_TYPE_ESP32_DEVKITC}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM}" STREQUAL "y")) + set(PRIV_INCLUDE_DIRS_LIST ${PRIV_INCLUDE_DIRS_LIST} + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/screen-framework/include") + set(PRIV_REQUIRES_LIST chip QRCode bt) +elseif(("${CONFIG_DEVICE_TYPE_M5STACK}" STREQUAL "y") OR ("${CONFIG_DEVICE_TYPE_ESP32_WROVER_KIT}" STREQUAL "y")) + set(PRIV_REQUIRES_LIST chip QRCode bt tft spidrier screen-framework) +endif() + +idf_component_register(PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST} + SRC_DIRS ${SRC_DIRS_LIST} + PRIV_REQUIRES ${PRIV_REQUIRES_LIST}) set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14) target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/all-clusters-app/esp32/main/Kconfig.projbuild b/examples/all-clusters-app/esp32/main/Kconfig.projbuild index fbaa3906f712a7..487528fce73940 100644 --- a/examples/all-clusters-app/esp32/main/Kconfig.projbuild +++ b/examples/all-clusters-app/esp32/main/Kconfig.projbuild @@ -31,10 +31,16 @@ menu "Demo" config DEVICE_TYPE_ESP32_DEVKITC bool "ESP32-DevKitC" + depends on IDF_TARGET_ESP32 config DEVICE_TYPE_ESP32_WROVER_KIT bool "ESP32-WROVER-KIT_V4.1" + depends on IDF_TARGET_ESP32 config DEVICE_TYPE_M5STACK bool "M5Stack" + depends on IDF_TARGET_ESP32 + config DEVICE_TYPE_ESP32_C3_DEVKITM + bool "EXP32C3-DevKitM" + depends on IDF_TARGET_ESP32C3 endchoice choice @@ -71,6 +77,7 @@ menu "Demo" int range 0 5 default 0 if DEVICE_TYPE_ESP32_DEVKITC + default 0 if DEVICE_TYPE_ESP32_C3_DEVKITM default 3 if DEVICE_TYPE_M5STACK default 4 if DEVICE_TYPE_ESP32_WROVER_KIT diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index 0e3074414d1063..d8cded87c63a3e 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -85,6 +85,10 @@ using namespace ::chip::DeviceLayer; #define STATUS_LED_GPIO_NUM GPIO_NUM_2 // Use LED1 (blue LED) as status LED on DevKitC +#elif CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM + +#define STATUS_LED_GPIO_NUM GPIO_NUM_2 + #else // !CONFIG_DEVICE_TYPE_ESP32_DEVKITC #error "Unsupported device type selected" diff --git a/examples/lock-app/esp32/CMakeLists.txt b/examples/lock-app/esp32/CMakeLists.txt index cbe9c2a1baec5e..f16f34612ebce7 100644 --- a/examples/lock-app/esp32/CMakeLists.txt +++ b/examples/lock-app/esp32/CMakeLists.txt @@ -21,11 +21,12 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake) set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components" - "${CMAKE_CURRENT_LIST_DIR}/../../common/m5stack-tft/repo/components" + "${CMAKE_CURRENT_LIST_DIR}/../../common/m5stack-tft/repo/components/tft" + "${CMAKE_CURRENT_LIST_DIR}/../../common/m5stack-tft/repo/components/spidriver" "${CMAKE_CURRENT_LIST_DIR}/../../common/QRCode" "${CMAKE_CURRENT_LIST_DIR}/../../common/screen-framework" ) project(chip-lock-app) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=c++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND) diff --git a/examples/lock-app/esp32/README.md b/examples/lock-app/esp32/README.md index 7068e64ebbe02e..5dbf598464a371 100644 --- a/examples/lock-app/esp32/README.md +++ b/examples/lock-app/esp32/README.md @@ -22,13 +22,14 @@ Development Framework and the xtensa-esp32-elf toolchain. The VSCode devcontainer has these components pre-installed, so you can skip this step. To install these components manually, follow these steps: -- Clone the Espressif ESP-IDF and checkout release/v4.2 branch +- Clone the Espressif ESP-IDF and checkout + [v4.3 tag](https://github.com/espressif/esp-idf/releases/v4.3) $ mkdir ${HOME}/tools $ cd ${HOME}/tools $ git clone https://github.com/espressif/esp-idf.git $ cd esp-idf - $ git checkout release/v4.2 + $ git checkout v4.3 $ git submodule update --init $ ./install.sh diff --git a/examples/persistent-storage/esp32/CMakeLists.txt b/examples/persistent-storage/esp32/CMakeLists.txt index 7aeda8f641e2e0..0e0a452beab877 100644 --- a/examples/persistent-storage/esp32/CMakeLists.txt +++ b/examples/persistent-storage/esp32/CMakeLists.txt @@ -23,5 +23,5 @@ set(EXTRA_COMPONENT_DIRS ) project(persistent-storage) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=c++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND) diff --git a/examples/persistent-storage/esp32/README.md b/examples/persistent-storage/esp32/README.md index a9c15dd1f96caa..66b9f6b72a0597 100644 --- a/examples/persistent-storage/esp32/README.md +++ b/examples/persistent-storage/esp32/README.md @@ -41,13 +41,14 @@ Development Framework and the xtensa-esp32-elf toolchain. The VSCode devcontainer has these components pre-installed, so you can skip this step. To install these components manually, follow these steps: -- Clone the Espressif ESP-IDF and checkout release/v4.2 branch +- Clone the Espressif ESP-IDF and checkout + [v4.3 tag](https://github.com/espressif/esp-idf/releases/v4.3) $ mkdir ${HOME}/tools $ cd ${HOME}/tools $ git clone https://github.com/espressif/esp-idf.git $ cd esp-idf - $ git checkout release/v4.2 + $ git checkout v4.3 $ git submodule update --init $ ./install.sh diff --git a/examples/pigweed-app/esp32/CMakeLists.txt b/examples/pigweed-app/esp32/CMakeLists.txt index 0007ceb6a6be10..1ef286f64220d0 100644 --- a/examples/pigweed-app/esp32/CMakeLists.txt +++ b/examples/pigweed-app/esp32/CMakeLists.txt @@ -24,5 +24,5 @@ set(EXTRA_COMPONENT_DIRS ) project(chip-pigweed-app) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=c++17;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND) diff --git a/examples/pigweed-app/esp32/README.md b/examples/pigweed-app/esp32/README.md index 2d4fc6b5c0d5d6..a981409164a00c 100644 --- a/examples/pigweed-app/esp32/README.md +++ b/examples/pigweed-app/esp32/README.md @@ -35,13 +35,14 @@ Development Framework and the xtensa-esp32-elf toolchain. The VSCode devcontainer has these components pre-installed, so you can skip this step. To install these components manually, follow these steps: -- Clone the Espressif ESP-IDF and checkout release/v4.2 branch +- Clone the Espressif ESP-IDF and checkout + [v4.3 tag](https://github.com/espressif/esp-idf/releases/v4.3) $ mkdir ${HOME}/tools $ cd ${HOME}/tools $ git clone https://github.com/espressif/esp-idf.git $ cd esp-idf - $ git checkout release/v4.2 + $ git checkout v4.3 $ git submodule update --init $ ./install.sh diff --git a/examples/shell/esp32/main/CMakeLists.txt b/examples/shell/esp32/main/CMakeLists.txt index 0f968d7a97dc6d..ae4b1dd629af59 100644 --- a/examples/shell/esp32/main/CMakeLists.txt +++ b/examples/shell/esp32/main/CMakeLists.txt @@ -26,4 +26,4 @@ idf_component_register(SRCS main.cpp PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src" "${CHIP_SHELL_DIR}/shell_common/include" - PRIV_REQUIRES chip nvs_flash bt console) + PRIV_REQUIRES chip nvs_flash bt console esp32_mbedtls) diff --git a/examples/temperature-measurement-app/esp32/CMakeLists.txt b/examples/temperature-measurement-app/esp32/CMakeLists.txt index 5045aff170f121..1638b6d067a270 100644 --- a/examples/temperature-measurement-app/esp32/CMakeLists.txt +++ b/examples/temperature-measurement-app/esp32/CMakeLists.txt @@ -27,11 +27,12 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake) set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components" - "${CMAKE_CURRENT_LIST_DIR}/../../common/m5stack-tft/repo/components" + "${CMAKE_CURRENT_LIST_DIR}/../../common/m5stack-tft/repo/components/tft" + "${CMAKE_CURRENT_LIST_DIR}/../../common/m5stack-tft/repo/components/spidriver" "${CMAKE_CURRENT_LIST_DIR}/../../common/QRCode" "${CMAKE_CURRENT_LIST_DIR}/../../common/screen-framework" ) project(chip-temperature-measurement-app) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=c++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND) diff --git a/examples/temperature-measurement-app/esp32/README.md b/examples/temperature-measurement-app/esp32/README.md index dd6c1fbf6f7e00..74dda064f62d24 100644 --- a/examples/temperature-measurement-app/esp32/README.md +++ b/examples/temperature-measurement-app/esp32/README.md @@ -22,13 +22,14 @@ Development Framework and the xtensa-esp32-elf toolchain. The VSCode devcontainer has these components pre-installed, so you can skip this step. To install these components manually, follow these steps: -- Clone the Espressif ESP-IDF and checkout release/v4.2 branch +- Clone the Espressif ESP-IDF and checkout + [v4.3 tag](https://github.com/espressif/esp-idf/releases/v4.3) $ mkdir ${HOME}/tools $ cd ${HOME}/tools $ git clone https://github.com/espressif/esp-idf.git $ cd esp-idf - $ git checkout release/v4.2 + $ git checkout v4.3 $ git submodule update --init $ ./install.sh diff --git a/integrations/docker/images/chip-build-esp32/Dockerfile b/integrations/docker/images/chip-build-esp32/Dockerfile index 49c1071a1e8d0c..911ecb47c4a46e 100644 --- a/integrations/docker/images/chip-build-esp32/Dockerfile +++ b/integrations/docker/images/chip-build-esp32/Dockerfile @@ -7,9 +7,8 @@ RUN set -x \ && DEBIAN_FRONTEND=noninteractive apt-get install -y python libgcrypt20-dev \ && mkdir -p /opt/espressif \ && cd /opt/espressif \ - && git clone --progress -b release/v4.2 https://github.com/espressif/esp-idf.git \ + && git clone --progress -b v4.3 https://github.com/espressif/esp-idf.git \ && cd esp-idf \ - && git reset --hard d9ec7df3931bea46292f015a99d19a28670bd561 \ && git submodule update --init --progress \ && IDF_TOOLS_PATH=/opt/espressif/tools ./install.sh \ && : # last line diff --git a/scripts/constraints.txt b/scripts/constraints.txt index 5509c399317bbe..b4bf9f50291770 100644 --- a/scripts/constraints.txt +++ b/scripts/constraints.txt @@ -154,7 +154,7 @@ python-dateutil==2.8.1 # pykwalify python-engineio==4.2.0 # via python-socketio -python-socketio==5.3.0 +python-socketio<5 # via flask-socketio pytz==2021.1 # via pandas diff --git a/scripts/requirements.esp32.txt b/scripts/requirements.esp32.txt index 086fcc35550cb8..b92bc3b6aaf87a 100644 --- a/scripts/requirements.esp32.txt +++ b/scripts/requirements.esp32.txt @@ -10,3 +10,6 @@ pygdbmi<=0.9.0.2 reedsolo>=1.5.3,<=1.5.4 bitstring>=3.1.6 ecdsa>=0.16.0 +kconfiglib==13.7.1 +construct==2.10.54 +python-socketio<5 diff --git a/src/lib/core/CHIPTLV.h b/src/lib/core/CHIPTLV.h index 1993b17d3d7488..b0648e0c24db45 100644 --- a/src/lib/core/CHIPTLV.h +++ b/src/lib/core/CHIPTLV.h @@ -957,6 +957,16 @@ class DLL_EXPORT TLVWriter */ CHIP_ERROR Put(uint64_t tag, int64_t v, bool preserveSize); +#if defined(__riscv)&&defined(ESP_PLATFORM) + /** + * @overload CHIP_ERROR TLVWriter::Put(uint64_t tag, int8_t v) + * for riscv_toolchain uint32_t is unsigned long int and int32_t is long int + */ + CHIP_ERROR Put(uint64_t tag, int v); + + CHIP_ERROR Put(uint64_t tag, unsigned int v); +#endif + /** * Encodes a TLV unsigned integer value. * diff --git a/src/lib/core/CHIPTLVWriter.cpp b/src/lib/core/CHIPTLVWriter.cpp index 41553024cd3b36..05a5a3a5b0b796 100644 --- a/src/lib/core/CHIPTLVWriter.cpp +++ b/src/lib/core/CHIPTLVWriter.cpp @@ -183,6 +183,18 @@ CHIP_ERROR TLVWriter::Put(uint64_t tag, int32_t v) return Put(tag, static_cast(v)); } +#if defined(__riscv)&&defined(ESP_PLATFORM) +CHIP_ERROR TLVWriter::Put(uint64_t tag, int v) +{ + return Put(tag, static_cast(v)); +} + +CHIP_ERROR TLVWriter::Put(uint64_t tag, unsigned int v) +{ + return Put(tag, static_cast(v)); +} +#endif + CHIP_ERROR TLVWriter::Put(uint64_t tag, int32_t v, bool preserveSize) { if (preserveSize) diff --git a/src/platform/ESP32/PlatformManagerImpl.cpp b/src/platform/ESP32/PlatformManagerImpl.cpp index b90115c70d999e..2b35fdd82b866a 100644 --- a/src/platform/ESP32/PlatformManagerImpl.cpp +++ b/src/platform/ESP32/PlatformManagerImpl.cpp @@ -90,7 +90,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) esp_fill_random(ap_mac, sizeof(ap_mac)); /* Bit 0 of the first octet of MAC Address should always be 0 */ ap_mac[0] &= (uint8_t) ~0x01; - err = esp_wifi_set_mac(ESP_IF_WIFI_AP, ap_mac); + err = esp_wifi_set_mac(WIFI_IF_AP, ap_mac); SuccessOrExit(err); } diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp index d15b230912a2a9..2e367433ae7654 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp @@ -1078,8 +1078,11 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void) CHIP_ERROR err; ble_gap_adv_params adv_params; memset(&adv_params, 0, sizeof(adv_params)); +#ifdef CONFIG_BT_NIMBLE_HOST_BASED_PRIVACY uint8_t own_addr_type = BLE_OWN_ADDR_RANDOM; - +#else + uint8_t own_addr_type = BLE_OWN_ADDR_RPA_PUBLIC_DEFAULT; +#endif adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN; mFlags.Clear(Flags::kAdvertisingRefreshNeeded); @@ -1117,6 +1120,7 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void) return err; } } +#if CONFIG_BT_NIMBLE_HOST_BASED_PRIVACY else { err = MapBLEError(ble_hs_pvcy_rpa_config(NIMBLE_HOST_ENABLE_RPA)); @@ -1126,6 +1130,7 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void) return err; } } +#endif err = MapBLEError(ble_gap_adv_start(own_addr_type, NULL, BLE_HS_FOREVER, &adv_params, ble_svr_gap_event, NULL)); if (err == CHIP_NO_ERROR) { diff --git a/src/test_driver/esp32/README.md b/src/test_driver/esp32/README.md index f45292f3d1fc28..0d53ff2d0d3f55 100644 --- a/src/test_driver/esp32/README.md +++ b/src/test_driver/esp32/README.md @@ -29,13 +29,14 @@ The `chip-build` Docker container and VSCode devcontainer has these components pre-installed, so you can skip this step. To install these components manually, follow these steps: -- Clone the Espressif ESP-IDF and checkout release/v4.2 branch +- Clone the Espressif ESP-IDF and checkout + [v4.3 tag](https://github.com/espressif/esp-idf/releases/v4.3) $ mkdir -p ${HOME}/tools $ cd ${HOME}/tools $ git clone https://github.com/espressif/esp-idf.git $ cd esp-idf - $ git checkout release/v4.2 + $ git checkout v4.3 $ git submodule update --init $ export IDF_PATH=${HOME}/tools/esp-idf $ ./install.sh