Skip to content

Commit

Permalink
Merge branch 'esp_matter_v1_3_1_component' into 'release/v1.3'
Browse files Browse the repository at this point in the history
esp_matter managed component: update v1.3.1

See merge request app-frameworks/esp-matter!925
  • Loading branch information
chshu committed Dec 27, 2024
2 parents dd8ba9f + 7aafd5c commit f1cd133
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 42 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog for esp_matter component registry

## [1.3.1](https://components.espressif.com/components/espressif/esp_matter/versions/1.3.1)

#### Features

- Work with IDF component management (version >= 2.0) without hash problem
- External platform path setting: support both absolute path or relative path to top-level CMakeLists
- More default compile options for the source files
- Could enable CONFIG_CHIP_OTA_IMAGE_BUILD to generate ota.bin file with IDF component management (version >= 2.0)
- esp-matter commit: 5a9bc09a640d5cfd4c6b137f7e3b13ce5fa9cca4
- connectedhomeip commit: 735b69f73e386cb675242371afd0b237a8a78982

## [1.3.0](https://components.espressif.com/components/espressif/esp_matter/versions/1.3.0)

#### Features
Expand Down
77 changes: 54 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
get_filename_component(MATTER_SDK_PATH ${CMAKE_CURRENT_SOURCE_DIR}/connectedhomeip/connectedhomeip/ REALPATH)

get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_LIST_DIR}/connectedhomeip/connectedhomeip/ REALPATH)
include(${CMAKE_CURRENT_LIST_DIR}/connectedhomeip/connectedhomeip/config/esp32/components/chip/ota-image.cmake)

set(ESP_COMPONENTS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/components)

Expand All @@ -27,6 +26,7 @@ endfunction()
set(SRC_DIRS_LIST "${MATTER_SDK_PATH}/src/access"
"${MATTER_SDK_PATH}/src/access/examples"
"${MATTER_SDK_PATH}/src/app"
"${MATTER_SDK_PATH}/src/app/data-model"
"${MATTER_SDK_PATH}/src/app/MessageDef"
"${MATTER_SDK_PATH}/src/app/reporting"
"${MATTER_SDK_PATH}/src/app/server"
Expand Down Expand Up @@ -54,6 +54,7 @@ set(SRC_DIRS_LIST "${MATTER_SDK_PATH}/src/access"
"${MATTER_SDK_PATH}/src/protocols"
"${MATTER_SDK_PATH}/src/protocols/bdx"
"${MATTER_SDK_PATH}/src/protocols/echo"
"${MATTER_SDK_PATH}/src/protocols/interaction_model"
"${MATTER_SDK_PATH}/src/protocols/secure_channel"
"${MATTER_SDK_PATH}/src/protocols/user_directed_commissioning"
"${MATTER_SDK_PATH}/src/setup_payload"
Expand Down Expand Up @@ -111,6 +112,7 @@ set(EXCLUDE_SRCS_LIST "${MATTER_SDK_PATH}/src/controller/ExamplePersistentStorag
"${MATTER_SDK_PATH}/src/lib/shell/commands/NFC.cpp"
"${MATTER_SDK_PATH}/src/platform/DeviceSafeQueue.cpp"
"${MATTER_SDK_PATH}/src/platform/SyscallStubs.cpp"
"${MATTER_SDK_PATH}/src/platform/OpenThread/DnssdImpl.cpp"
"${MATTER_SDK_PATH}/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread_LwIP.cpp"
"${MATTER_SDK_PATH}/src/system/SystemLayerImplSelect.cpp"
"${MATTER_SDK_PATH}/src/transport/TraceMessage.cpp")
Expand Down Expand Up @@ -254,8 +256,7 @@ if((NOT CONFIG_ENABLE_WIFI_STATION) AND (NOT CONFIG_ENABLE_WIFI_AP))
endif()

if (NOT CONFIG_ENABLE_MATTER_OVER_THREAD)
list(APPEND EXCLUDE_SRCS_LIST "${MATTER_SDK_PATH}/src/platform/OpenThread/DnssdImpl.cpp"
"${MATTER_SDK_PATH}/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp"
list(APPEND EXCLUDE_SRCS_LIST "${MATTER_SDK_PATH}/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp"
"${MATTER_SDK_PATH}/src/platform/OpenThread/OpenThreadUtils.cpp"
"${MATTER_SDK_PATH}/src/platform/OpenThread/OpenThreadDnssdImpl.cpp")
endif()
Expand All @@ -272,7 +273,7 @@ else()
set(CHIP_PROJECT_CONFIG "")
endif()

if (CONFIG_ENABLE_ESP_INSIGHTS_TRACE)
if (CONFIG_ENABLE_ESP_INSIGHTS_TRACE AND (NOT "${IDF_TARGET}" STREQUAL "esp32h2"))
list(APPEND SRC_DIRS_LIST "${MATTER_SDK_PATH}/src/tracing/esp32_trace")
list(APPEND INCLUDE_DIRS_LIST "${MATTER_SDK_PATH}/src/tracing/esp32_trace/include"
"${MATTER_SDK_PATH}/src/tracing/esp32_trace")
Expand All @@ -288,8 +289,14 @@ endif()

if (CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM)
# check the source file dir if external platform is enable
if ((EXISTS ${CONFIG_CHIP_EXTERNAL_PLATFORM_DIR}/external_platform.cmake))
include(${CONFIG_CHIP_EXTERNAL_PLATFORM_DIR}/external_platform.cmake)
if (IS_ABSOLUTE ${CONFIG_CHIP_EXTERNAL_PLATFORM_DIR})
get_filename_component(EXTERNAL_PLATFORM_DIR ${CONFIG_CHIP_EXTERNAL_PLATFORM_DIR} REALPATH)
else()
get_filename_component(EXTERNAL_PLATFORM_DIR ${CMAKE_SOURCE_DIR}/${CONFIG_CHIP_EXTERNAL_PLATFORM_DIR} REALPATH)
endif()
message("EXTERNAL_PLATFORM_DIR: ${EXTERNAL_PLATFORM_DIR}")
if ((EXISTS ${EXTERNAL_PLATFORM_DIR}/external_platform.cmake))
include(${EXTERNAL_PLATFORM_DIR}/external_platform.cmake)
list(APPEND SRC_DIRS_LIST ${EXPLANT_SRC_DIRS_LIST})
list(APPEND INCLUDE_DIRS_LIST ${EXPLANT_INCLUDE_DIRS_LIST})
list(APPEND EXCLUDE_SRCS_LIST ${EXPLANT_EXCLUDE_SRCS_LIST})
Expand Down Expand Up @@ -328,17 +335,15 @@ else()
if ((CONFIG_BT_ENABLED) AND (CONFIG_ENABLE_CHIPOBLE))
if (CONFIG_BT_NIMBLE_ENABLED)
list(APPEND SRC_DIRS_LIST "${MATTER_SDK_PATH}/src/platform/ESP32/nimble")
list(APPEND EXCLUDE_SRCS_LIST "${MATTER_SDK_PATH}/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp")
if(NOT CONFIG_ENABLE_ESP32_BLE_CONTROLLER)
list(APPEND EXCLUDE_SRCS_LIST "${MATTER_SDK_PATH}/src/platform/ESP32/bluedroid/ChipDeviceScanner.cpp")
if (NOT CONFIG_ENABLE_ESP32_BLE_CONTROLLER)
list(APPEND EXCLUDE_SRCS_LIST "${MATTER_SDK_PATH}/src/platform/ESP32/nimble/ChipDeviceScanner.cpp"
"${MATTER_SDK_PATH}/src/platform/ESP32/nimble/misc.c"
"${MATTER_SDK_PATH}/src/platform/ESP32/nimble/peer.c")
endif()
else()
list(APPEND SRC_DIRS_LIST "${MATTER_SDK_PATH}/src/platform/ESP32/bluedroid")
list(APPEND EXCLUDE_SRCS_LIST "${MATTER_SDK_PATH}/src/platform/ESP32/nimble/BLEManagerImpl.cpp")
if(NOT CONFIG_ENABLE_ESP32_BLE_CONTROLLER)
list(APPEND EXCLUDE_SRCS_LIST "${MATTER_SDK_PATH}/src/platform/ESP32/nimble/ChipDeviceScanner.cpp"
"${MATTER_SDK_PATH}/src/platform/ESP32/nimble/misc.c"
"${MATTER_SDK_PATH}/src/platform/ESP32/nimble/peer.c")
if (NOT CONFIG_ENABLE_ESP32_BLE_CONTROLLER)
list(APPEND EXCLUDE_SRCS_LIST "${MATTER_SDK_PATH}/src/platform/ESP32/bluedroid/ChipDeviceScanner.cpp")
endif()
endif()
endif()
Expand All @@ -362,7 +367,8 @@ else()
endif()

if (NOT CONFIG_ENABLE_ESP32_DEVICE_INFO_PROVIDER)
list(APPEND EXCLUDE_SRCS_LIST "${MATTER_SDK_PATH}/src/platform/ESP32/ESP32DeviceInfoProvider.cpp")
list(APPEND EXCLUDE_SRCS_LIST "${MATTER_SDK_PATH}/src/platform/ESP32/ESP32DeviceInfoProvider.cpp"
"${MATTER_SDK_PATH}/src/platform/ESP32/StaticESP32DeviceInfoProvider.cpp")
endif()

if (NOT CONFIG_SEC_CERT_DAC_PROVIDER)
Expand Down Expand Up @@ -394,17 +400,34 @@ idf_component_register(SRC_DIRS ${SRC_DIRS_LIST}

target_compile_options(${COMPONENT_LIB} PUBLIC
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
"-DCHIP_CONFIG_SOFTWARE_VERSION_NUMBER=${chip_config_software_version_number}")
"-DCHIP_CONFIG_SOFTWARE_VERSION_NUMBER=${chip_config_software_version_number}"
"-DNDEBUG")

if (CHIP_PROJECT_CONFIG)
target_compile_options(${COMPONENT_LIB} PUBLIC
"-DCHIP_PROJECT_CONFIG_INCLUDE=${CHIP_PROJECT_CONFIG}"
"-DSYSTEM_PROJECT_CONFIG_INCLUDE=${CHIP_PROJECT_CONFIG}")
endif()

idf_build_set_property(COMPILE_OPTIONS "-Wno-error=uninitialized;-Wno-error=maybe-uninitialized;-Wno-format-nonliteral;-Wno-missing-field-initializers;" APPEND)
idf_build_set_property(COMPILE_OPTIONS "-Wno-error=array-bounds" APPEND)
idf_build_set_property(COMPILE_OPTIONS "-Wno-write-strings" APPEND)
# compile options from connectedhomeip/build/config/compiler except -Wconversion, -Wshadow, and -Wno-unknown-warning-option
target_compile_options(${COMPONENT_LIB} PRIVATE "-g2;-fno-common;-fno-unwind-tables;-fno-asynchronous-unwind-tables")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wstack-usage=8192;-Wunreachable-code;-Wvla")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wformat;-Wformat-nonliteral;-Wformat-security")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-deprecated-declarations;-Wno-unused")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-cast-function-type;-Wno-psabi;-Wno-maybe-uninitialized;-fno-strict-aliasing")
target_compile_options(${COMPONENT_LIB} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wnon-virtual-dtor>)

# link options from connectedhomeip/build/config/compiler
target_link_options(${COMPONENT_LIB} PRIVATE -Wl,-O2 -Wl,--gc-sections -Os -Werror -Wl,--fatal-warnings -fdiagnostics-color)

# compile options from esp-matter/components/
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-error=uninitialized;-Wno-error=maybe-uninitialized;-Wno-missing-field-initializers")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-error=array-bounds;-Wno-write-strings")

# TODO: remove this when building connectedhomeip/src/controller/CHIPDeviceController.cpp with no format error
if (CONFIG_ENABLE_CHIP_CONTROLLER_BUILD)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-error=format")
endif()

# For Xtensa chips, uint32_t was defined as 'unsigned' before v5.0, and after IDF v5.0 it is defined
# as 'unsigned long', same as RISC-V. add this compile option to avoid format errors.
Expand All @@ -422,9 +445,13 @@ if (CONFIG_USE_MINIMAL_MDNS)
target_compile_options(${COMPONENT_LIB} PUBLIC "-DCHIP_MINMDNS_DEFAULT_POLICY=1"
"-DCHIP_MINMDNS_USE_EPHEMERAL_UNICAST_PORT=0"
"-DCHIP_MINMDNS_HIGH_VERBOSITY=0"
"-DCHIP_DNSSD_DEFAULT_MINIMAL=1")
"-DCHIP_DNSSD_DEFAULT_MINIMAL=true"
"-DCHIP_DNSSD_DEFAULT_NONE=false"
"-DCHIP_DNSSD_DEFAULT_PLATFORM=false")
else()
target_compile_options(${COMPONENT_LIB} PUBLIC "-DCHIP_DNSSD_DEFAULT_PLATFORM=1")
target_compile_options(${COMPONENT_LIB} PUBLIC "-DCHIP_DNSSD_DEFAULT_PLATFORM=true"
"-DCHIP_DNSSD_DEFAULT_NONE=false"
"-DCHIP_DNSSD_DEFAULT_MINIMAL=false")
endif()

if (NOT CMAKE_BUILD_EARLY_EXPANSION)
Expand Down Expand Up @@ -455,13 +482,17 @@ target_link_libraries(${COMPONENT_LIB} INTERFACE -Wl,--start-group
${chip_libraries}
-Wl,--end-group)

# TODO: Build OTA image need a python package, leading a file change and distorying the hash of managed_components.
cmake_policy(GET CMP0007 policy_status)
# Set new CMP0007 policy to prevent cmake warning
cmake_policy(SET CMP0007 NEW)
include(${CMAKE_CURRENT_LIST_DIR}/connectedhomeip/connectedhomeip/config/esp32/components/chip/ota-image.cmake)
# Build Matter OTA image
if (false AND CONFIG_CHIP_OTA_IMAGE_BUILD)
if (CONFIG_CHIP_OTA_IMAGE_BUILD)
chip_ota_image(chip-ota-image
INPUT_FILES ${BUILD_DIR}/${CMAKE_PROJECT_NAME}.bin
OUTPUT_FILE ${BUILD_DIR}/${CMAKE_PROJECT_NAME}-ota.bin
)
# Adding dependecy as app target so that this runs after images are ready
add_dependencies(chip-ota-image app)
endif()
cmake_policy(SET CMP0007 ${policy_status})
5 changes: 3 additions & 2 deletions docs/en/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ An example with esp_matter component is offered:

.. note::

To use this component, the version of IDF component management should be 1.4.*.
Use ``compote version`` to show the version. Use ``pip install 'idf-component-manager~=1.4.0'`` to install.
To use this component, the version of IDF component management should be ``1.4.*`` or ``>= 2.0``.
Use ``compote version`` to show the version. Use ``pip install 'idf-component-manager~=1.4.0'``
or ``pip install 'idf-component-manager~=2.0.0'`` to install.

2.2.3 Building Applications
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ if (NOT CONFIG_ENABLE_ETHERNET_TELEMETRY)
"${CMAKE_CURRENT_LIST_DIR}/NetworkCommissioningDriver_Ethernet.cpp")
endif()

if (NOT CONFIG_ENABLE_MATTER_OVER_THREAD)
list(APPEND EXPLANT_EXCLUDE_SRCS_LIST "${CMAKE_CURRENT_LIST_DIR}/OpenthreadLauncher.c"
if ((NOT CONFIG_OPENTHREAD_ENABLED) OR (NOT CONFIG_ENABLE_MATTER_OVER_THREAD))
list(APPEND EXPLANT_EXCLUDE_SRCS_LIST "${CMAKE_CURRENT_LIST_DIR}/OpenthreadLauncher.cpp"
"${CMAKE_CURRENT_LIST_DIR}/ThreadStackManagerImpl.cpp")
endif()

Expand All @@ -78,3 +78,9 @@ endif()
if (NOT CONFIG_USE_ESP32_ECDSA_PERIPHERAL)
list(APPEND EXPLANT_EXCLUDE_SRCS_LIST "${CMAKE_CURRENT_LIST_DIR}/ESP32CHIPCryptoPAL.cpp")
endif()

if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/generate-include-files.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/generate-include-files.cmake)
else()
message(FATAL_ERROR "There should be a generate-include-files.cmake file in CONFIG_CHIP_EXTERNAL_PLATFORM_DIR!")
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
if (CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM)
# Generating platform/CHIPDeviceBuildConfig.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/platform/CHIPDeviceBuildConfig.h
"#pragma once\n
#include <sdkconfig.h>\n
#if defined(CONFIG_ENABLE_WIFI_STATION) || defined(CONFIG_ENABLE_WIFI_AP)
#define CHIP_DEVICE_CONFIG_ENABLE_WPA 1
#else
#define CHIP_DEVICE_CONFIG_ENABLE_WPA 0
#endif
#ifdef CONFIG_ENABLE_MATTER_OVER_THREAD
#define CHIP_ENABLE_OPENTHREAD 1
#else
#define CHIP_ENABLE_OPENTHREAD 0
#endif
#ifdef CONFIG_OPENTHREAD_FTD
#define CHIP_DEVICE_CONFIG_THREAD_FTD 1
#else
#define CHIP_DEVICE_CONFIG_THREAD_FTD 0
#endif
#ifdef CONFIG_OPENTHREAD_BORDER_ROUTER
#define CHIP_DEVICE_CONFIG_THREAD_BORDER_ROUTER 1
#else
#define CHIP_DEVICE_CONFIG_THREAD_BORDER_ROUTER 0
#endif
#define CHIP_DEVICE_CONFIG_USES_OTBR_POSIX_DBUS_STACK 0
#define CHIP_STACK_LOCK_TRACKING_ENABLED 1
#define CHIP_STACK_LOCK_TRACKING_ERROR_FATAL 1
#ifdef CONFIG_ENABLE_ROTATING_DEVICE_ID
#define CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING 1
#else
#define CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING 0
#endif
#define CHIP_DEVICE_CONFIG_RUN_AS_ROOT 1
#define CHIP_DISABLE_PLATFORM_KVS 0
#ifdef CONFIG_ENABLE_OTA_REQUESTOR
#define CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR 1
#else
#define CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR 0
#endif
#ifdef CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER
#define CHIP_USE_TRANSITIONAL_COMMISSIONABLE_DATA_PROVIDER 0
#else
#define CHIP_USE_TRANSITIONAL_COMMISSIONABLE_DATA_PROVIDER 1
#endif
#define CHIP_USE_TRANSITIONAL_DEVICE_INSTANCE_INFO_PROVIDER 1
#define CHIP_DEVICE_LAYER_TARGET_ESP32 1
#define CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES 5
#define CHIP_DEVICE_CONFIG_ENABLE_DYNAMIC_MRP_CONFIG 0
#define CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF 0
#if defined(CONFIG_ENABLE_MATTER_OVER_THREAD) && defined(CONFIG_THREAD_NETWORK_COMMISSIONING_DRIVER)
#define CHIP_DEVICE_CONFIG_THREAD_NETWORK_ENDPOINT_ID CONFIG_THREAD_NETWORK_ENDPOINT_ID
#endif
// For definitions for external platform
#define CHIP_DEVICE_LAYER_TARGET ESP32_custom
#define BLE_PLATFORM_CONFIG_INCLUDE <platform/ESP32_custom/BlePlatformConfig.h>
#define CHIP_DEVICE_PLATFORM_CONFIG_INCLUDE <platform/ESP32_custom/CHIPDevicePlatformConfig.h>
#define CHIP_PLATFORM_CONFIG_INCLUDE <platform/ESP32_custom/CHIPPlatformConfig.h>
#define INET_CONFIG_INCLUDE <platform/ESP32_custom/InetPlatformConfig.h>
#define SYSTEM_PLATFORM_CONFIG_INCLUDE <platform/ESP32_custom/SystemPlatformConfig.h>
#define EXTERNAL_CONFIGURATIONMANAGERIMPL_HEADER <platform/ESP32_custom/ConfigurationManagerImpl.h>
#define EXTERNAL_CHIPDEVICEPLATFORMEVENT_HEADER <platform/ESP32_custom/CHIPDevicePlatformEvent.h>
#define EXTERNAL_CONNECTIVITYMANAGERIMPL_HEADER <platform/ESP32_custom/ConnectivityManagerImpl.h>
#define EXTERNAL_BLEMANAGERIMPL_HEADER <platform/ESP32_custom/BLEManagerImpl.h>
#define EXTERNAL_KEYVALUESTOREMANAGERIMPL_HEADER <platform/ESP32_custom/KeyValueStoreManagerImpl.h>
#define EXTERNAL_PLATFORMMANAGERIMPL_HEADER <platform/ESP32_custom/PlatformManagerImpl.h>
#define EXTERNAL_THREADSTACKMANAGERIMPL_HEADER <platform/ESP32_custom/ThreadStackManagerImpl.h>
")
endif()
Loading

0 comments on commit f1cd133

Please sign in to comment.