diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 25df516e2..e65185d1f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -162,7 +162,7 @@ variables: # update caches only when setup succeed - *update_build_caches variables: - IDF_VERSION: "v4.4.3" + IDF_VERSION: "v5.0.1" REPOS_PATH: "$CI_PROJECT_DIR/repos" IDF_CCACHE_ENABLE: 1 @@ -173,6 +173,14 @@ build_esp_matter_examples: - *build_examples - *build_external_platform_example +build_esp_matter_examples_idf_v4_4: + extends: + - .build_examples_template + variables: + IDF_VERSION: "v4.4.3" + script: + - *build_examples + build_esp_matter_examples_idf_v5_1: extends: - .build_examples_template diff --git a/README.md b/README.md index d28fc98c1..b814c9895 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ git clone --recursive https://github.com/espressif/esp-matter.git ## Supported ESP-IDF and connectedhomeip versions - This SDK currently works with [commit bc8c9ece1](https://github.com/espressif/connectedhomeip/tree/bc8c9ece1) of connectedhomeip. -- For ESP32, ESP32-C3, and ESP32-S3, ESP-IDF [v4.4.3 release](https://github.com/espressif/esp-idf/releases/tag/v4.4.3) is required. +- For ESP32, ESP32-C3, and ESP32-S3, ESP-IDF [v5.0.1 release](https://github.com/espressif/esp-idf/releases/tag/v5.0.1) is required. - For ESP32-C2, ESP32-H2(preview) and ESP32-C6(preview) and Zigbee Bridge example, ESP-IDF branch at [commit bb9200ace](https://github.com/espressif/esp-idf/tree/bb9200ace) in branch release/v5.1 should be used. diff --git a/components/esp_matter/CMakeLists.txt b/components/esp_matter/CMakeLists.txt index fb2eea06b..46bbe12e6 100644 --- a/components/esp_matter/CMakeLists.txt +++ b/components/esp_matter/CMakeLists.txt @@ -79,5 +79,12 @@ idf_component_register( SRC_DIRS ${SRC_DIRS_LIST} # used uninitialized in this function idf_build_set_property(COMPILE_OPTIONS "-Wno-error=uninitialized;-Wno-error=maybe-uninitialized;-Wno-missing-field-initializers;" APPEND) idf_build_set_property(COMPILE_OPTIONS "-Wno-error=array-bounds" APPEND) + +# 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. +# https://github.com/espressif/esp-idf/issues/6906#issuecomment-1207373706 +if (CONFIG_IDF_TARGET_ARCH_XTENSA AND (${IDF_VERSION_MAJOR} LESS 5)) + idf_build_set_property(COMPILE_OPTIONS "-Wno-format" APPEND) +endif() target_compile_options(${COMPONENT_LIB} PUBLIC "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=") diff --git a/components/esp_matter/esp_matter_attribute_utils.cpp b/components/esp_matter/esp_matter_attribute_utils.cpp index a6bb98b07..fd9c3c5af 100644 --- a/components/esp_matter/esp_matter_attribute_utils.cpp +++ b/components/esp_matter/esp_matter_attribute_utils.cpp @@ -1590,51 +1590,51 @@ void val_print(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, { char action = (is_read) ? 'R' :'W'; if (val_is_null(val)) { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is null **********", action, endpoint_id, - cluster_id, attribute_id); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is null **********", action, + endpoint_id, cluster_id, attribute_id); return; } if (val->type == ESP_MATTER_VAL_TYPE_BOOLEAN) { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is %d **********", action, endpoint_id, - cluster_id, attribute_id, val->val.b); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is %d **********", action, + endpoint_id, cluster_id, attribute_id, val->val.b); } else if (val->type == ESP_MATTER_VAL_TYPE_INTEGER || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER) { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is %d **********", action, endpoint_id, - cluster_id, attribute_id, val->val.i); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is %d **********", action, + endpoint_id, cluster_id, attribute_id, val->val.i); } else if (val->type == ESP_MATTER_VAL_TYPE_FLOAT || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_FLOAT) { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is %f **********", action, endpoint_id, - cluster_id, attribute_id, val->val.f); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is %f **********", action, + endpoint_id, cluster_id, attribute_id, val->val.f); } else if (val->type == ESP_MATTER_VAL_TYPE_UINT8 || val->type == ESP_MATTER_VAL_TYPE_BITMAP8 || val->type == ESP_MATTER_VAL_TYPE_ENUM8 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_UINT8 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8) { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is %d **********", action, endpoint_id, - cluster_id, attribute_id, val->val.u8); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is %d **********", action, + endpoint_id, cluster_id, attribute_id, val->val.u8); } else if (val->type == ESP_MATTER_VAL_TYPE_INT16 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_INT16) { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is %d **********", action, endpoint_id, - cluster_id, attribute_id, val->val.i16); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is %d **********", action, + endpoint_id, cluster_id, attribute_id, val->val.i16); } else if (val->type == ESP_MATTER_VAL_TYPE_UINT16 || val->type == ESP_MATTER_VAL_TYPE_BITMAP16 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_UINT16 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16) { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is %d **********", action, endpoint_id, - cluster_id, attribute_id, val->val.u16); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is %d **********", action, + endpoint_id, cluster_id, attribute_id, val->val.u16); } else if (val->type == ESP_MATTER_VAL_TYPE_INT32|| val->type == ESP_MATTER_VAL_TYPE_NULLABLE_INT32) { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is %d **********", action, endpoint_id, - cluster_id, attribute_id, val->val.i32); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is %ld **********", action, + endpoint_id, cluster_id, attribute_id, val->val.i32); } else if (val->type == ESP_MATTER_VAL_TYPE_UINT32 || val->type == ESP_MATTER_VAL_TYPE_BITMAP32 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_UINT32 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP32) { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is %d **********", action, endpoint_id, - cluster_id, attribute_id, val->val.u32); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is %ld **********", action, + endpoint_id, cluster_id, attribute_id, val->val.u32); } else if (val->type == ESP_MATTER_VAL_TYPE_INT64 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_INT64) { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is %lld **********", action, endpoint_id, - cluster_id, attribute_id, val->val.i64); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is %lld **********", action, + endpoint_id, cluster_id, attribute_id, val->val.i64); } else if (val->type == ESP_MATTER_VAL_TYPE_UINT64 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_UINT64) { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is %lld **********", action, endpoint_id, - cluster_id, attribute_id, val->val.u64); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is %lld **********", action, + endpoint_id, cluster_id, attribute_id, val->val.u64); } else if (val->type == ESP_MATTER_VAL_TYPE_CHAR_STRING) { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is %.*s **********", action, endpoint_id, - cluster_id, attribute_id, val->val.a.s, val->val.a.b); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is %.*s **********", action, + endpoint_id, cluster_id, attribute_id, val->val.a.s, val->val.a.b); } else { - ESP_LOGI(TAG, "********** %c : Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is **********", action, - endpoint_id, cluster_id, attribute_id, val->type); + ESP_LOGI(TAG, "********** %c : Endpoint 0x%04x's Cluster 0x%08lx's Attribute 0x%08lx is **********", + action, endpoint_id, cluster_id, attribute_id, val->type); } } diff --git a/components/esp_matter/esp_matter_command.cpp b/components/esp_matter/esp_matter_command.cpp index c0176f542..e80fb9806 100644 --- a/components/esp_matter/esp_matter_command.cpp +++ b/components/esp_matter/esp_matter_command.cpp @@ -38,14 +38,14 @@ void DispatchSingleClusterCommandCommon(const ConcreteCommandPath &command_path, uint16_t endpoint_id = command_path.mEndpointId; uint32_t cluster_id = command_path.mClusterId; uint32_t command_id = command_path.mCommandId; - ESP_LOGI(TAG, "Received command 0x%08X for endpoint 0x%04X's cluster 0x%08X", command_id, endpoint_id, cluster_id); + ESP_LOGI(TAG, "Received command 0x%08lx for endpoint 0x%04x's cluster 0x%08lx", command_id, endpoint_id, cluster_id); node_t *node = node::get(); endpoint_t *endpoint = endpoint::get(node, endpoint_id); cluster_t *cluster = cluster::get(endpoint, cluster_id); command_t *command = get(cluster, command_id, COMMAND_FLAG_ACCEPTED); if (!command) { - ESP_LOGE(TAG, "Command 0x%04X not found", command_id); + ESP_LOGE(TAG, "Command 0x%08lx not found", command_id); return; } esp_err_t err = ESP_OK; diff --git a/components/esp_matter/esp_matter_core.cpp b/components/esp_matter/esp_matter_core.cpp index ffc33d87d..3b7072617 100644 --- a/components/esp_matter/esp_matter_core.cpp +++ b/components/esp_matter/esp_matter_core.cpp @@ -1023,7 +1023,7 @@ attribute_t *create(cluster_t *cluster, uint32_t attribute_id, uint8_t flags, es _cluster_t *current_cluster = (_cluster_t *)cluster; attribute_t *existing_attribute = get(cluster, attribute_id); if (existing_attribute) { - ESP_LOGW(TAG, "Attribute 0x%04x on cluster 0x%04x already exists. Not creating again.", attribute_id, + ESP_LOGW(TAG, "Attribute 0x%08lx on cluster 0x%08lx already exists. Not creating again.", attribute_id, current_cluster->cluster_id); return existing_attribute; } @@ -1306,14 +1306,14 @@ esp_err_t store_val_in_nvs(attribute_t *attribute) char nvs_namespace[16] = {0}; char attribute_key[16] = {0}; snprintf(nvs_namespace, 16, "endpoint_%X", endpoint_id); /* endpoint_id */ - snprintf(attribute_key, 16, "%X:%X", cluster_id, attribute_id); /* cluster_id:attribute_id */ + snprintf(attribute_key, 16, "%lX:%lX", cluster_id, attribute_id); /* cluster_id:attribute_id */ nvs_handle_t handle; esp_err_t err = nvs_open_from_partition(ESP_MATTER_NVS_PART_NAME, nvs_namespace, NVS_READWRITE, &handle); if (err != ESP_OK) { return err; } - ESP_LOGD(TAG, "Store attribute in nvs: endpoint_id-0x%x, cluster_id-0x%x, attribute_id-0x%x", + ESP_LOGD(TAG, "Store attribute in nvs: endpoint_id-0x%x, cluster_id-0x%lx, attribute_id-0x%lx", endpoint_id, cluster_id, attribute_id); if (current_attribute->val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING || current_attribute->val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING || @@ -1348,14 +1348,14 @@ esp_err_t get_val_from_nvs(attribute_t *attribute, esp_matter_attr_val_t *val) char nvs_namespace[16] = {0}; char attribute_key[16] = {0}; snprintf(nvs_namespace, 16, "endpoint_%X", endpoint_id); /* endpoint_id */ - snprintf(attribute_key, 16, "%X:%X", cluster_id, attribute_id); /* cluster_id:attribute_id */ + snprintf(attribute_key, 16, "%lX:%lX", cluster_id, attribute_id); /* cluster_id:attribute_id */ nvs_handle_t handle; esp_err_t err = nvs_open_from_partition(ESP_MATTER_NVS_PART_NAME, nvs_namespace, NVS_READONLY, &handle); if (err != ESP_OK) { return err; } - ESP_LOGD(TAG, "read attribute from nvs: endpoint_id-0x%x, cluster_id-0x%x, attribute_id-0x%x", + ESP_LOGD(TAG, "read attribute from nvs: endpoint_id-0x%x, cluster_id-0x%lx, attribute_id-0x%lx", endpoint_id, cluster_id, attribute_id); if (current_attribute->val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING || current_attribute->val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING || @@ -1395,7 +1395,7 @@ command_t *create(cluster_t *cluster, uint32_t command_id, uint8_t flags, callba _cluster_t *current_cluster = (_cluster_t *)cluster; command_t *existing_command = get(cluster, command_id, flags); if (existing_command) { - ESP_LOGW(TAG, "Command 0x%04x on cluster 0x%04x already exists. Not creating again.", command_id, + ESP_LOGW(TAG, "Command 0x%08lx on cluster 0x%08lx already exists. Not creating again.", command_id, current_cluster->cluster_id); return existing_command; } @@ -1529,20 +1529,20 @@ cluster_t *create(endpoint_t *endpoint, uint32_t cluster_id, uint8_t flags) /* If a server already exists, do not create it again */ _cluster_t *_existing_cluster = (_cluster_t *)existing_cluster; if ((_existing_cluster->flags & CLUSTER_FLAG_SERVER) && (flags & CLUSTER_FLAG_SERVER)) { - ESP_LOGW(TAG, "Server Cluster 0x%04x on endpoint 0x%04x already exists. Not creating again.", cluster_id, + ESP_LOGW(TAG, "Server Cluster 0x%08lx on endpoint 0x%04x already exists. Not creating again.", cluster_id, current_endpoint->endpoint_id); return existing_cluster; } /* If a client already exists, do not create it again */ if ((_existing_cluster->flags & CLUSTER_FLAG_CLIENT) && (flags & CLUSTER_FLAG_CLIENT)) { - ESP_LOGW(TAG, "Client Cluster 0x%04x on endpoint 0x%04x already exists. Not creating again.", cluster_id, + ESP_LOGW(TAG, "Client Cluster 0x%08lx on endpoint 0x%04x already exists. Not creating again.", cluster_id, current_endpoint->endpoint_id); return existing_cluster; } /* The cluster already exists, but is of a different type. Just update the 'Set' part from below. */ - ESP_LOGI(TAG, "Cluster 0x%04x on endpoint 0x%04x already exists. Updating values.", cluster_id, + ESP_LOGI(TAG, "Cluster 0x%08lx on endpoint 0x%04x already exists. Updating values.", cluster_id, current_endpoint->endpoint_id); _existing_cluster->flags |= flags; return existing_cluster; diff --git a/docs/en/developing.rst b/docs/en/developing.rst index 7bc7c67e6..13bd9b3f8 100644 --- a/docs/en/developing.rst +++ b/docs/en/developing.rst @@ -23,7 +23,7 @@ Additionally, we also support developing on Windows Host using WSL. The Prerequisites for ESP-IDF and Matter: -- Please see `Prerequisites `__ for ESP IDF. +- Please see `Prerequisites `__ for ESP IDF. - Please get the `Prerequisites `__ for Matter. @@ -47,16 +47,16 @@ For using VSCode for development, please check `Developing in WSL `__. +`secure_boot `__. 4.4.2 Flash Encryption ~~~~~~~~~~~~~~~~~~~~~~ @@ -152,7 +152,7 @@ allow to write the data to the flash by encrypting it. Both the read/write encryption operations happen transparently. Details about implementing the flash encryption can be found here: -`flash_encryption `__. +`flash_encryption `__. 4.4.3 NVS Encryption ~~~~~~~~~~~~~~~~~~~~ @@ -169,4 +169,4 @@ encryption becomes a mandatory feature to secure the NVS encryption keys. Details about implementing the NVS encryption can be found here: -`nvs_encryption `__. +`nvs_encryption `__. diff --git a/examples/blemesh_bridge/main/app_blemesh.c b/examples/blemesh_bridge/main/app_blemesh.c index 86e55d49c..f0674a4c5 100644 --- a/examples/blemesh_bridge/main/app_blemesh.c +++ b/examples/blemesh_bridge/main/app_blemesh.c @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -383,11 +384,11 @@ static void ble_mesh_config_client_cb(esp_ble_mesh_cfg_client_cb_event_t event, uint32_t opcode = param->params->opcode; uint16_t addr = param->params->ctx.addr; - ESP_LOGI(TAG, "%s, error_code = 0x%02x, event = 0x%02x, addr: 0x%04x, opcode: 0x%04x", + ESP_LOGI(TAG, "%s, error_code = 0x%02x, event = 0x%02x, addr: 0x%04x, opcode: 0x%04lx", __func__, param->error_code, event, param->params->ctx.addr, opcode); if (param->error_code) { - ESP_LOGE(TAG, "Send config client message failed, opcode 0x%04x", opcode); + ESP_LOGE(TAG, "Send config client message failed, opcode 0x%04lx", opcode); return; } @@ -526,11 +527,11 @@ static void ble_mesh_generic_client_cb(esp_ble_mesh_generic_client_cb_event_t ev uint32_t opcode = param->params->opcode; uint16_t addr = param->params->ctx.addr; - ESP_LOGI(TAG, "%s, error_code = 0x%02x, event = 0x%02x, addr: 0x%04x, opcode: 0x%04x", + ESP_LOGI(TAG, "%s, error_code = 0x%02x, event = 0x%02x, addr: 0x%04x, opcode: 0x%04lx", __func__, param->error_code, event, param->params->ctx.addr, opcode); if (param->error_code) { - ESP_LOGE(TAG, "Send generic client message failed, opcode 0x%04x", opcode); + ESP_LOGE(TAG, "Send generic client message failed, opcode 0x%04lx", opcode); return; } diff --git a/examples/blemesh_bridge/main/blemesh_bridge.cpp b/examples/blemesh_bridge/main/blemesh_bridge.cpp index 6e5c42f77..a1885495e 100644 --- a/examples/blemesh_bridge/main/blemesh_bridge.cpp +++ b/examples/blemesh_bridge/main/blemesh_bridge.cpp @@ -74,13 +74,15 @@ esp_err_t blemesh_bridge_attribute_update(uint16_t endpoint_id, uint32_t cluster if (bridged_device && bridged_device->dev && bridged_device->dev->endpoint) { if (cluster_id == OnOff::Id) { if (attribute_id == OnOff::Attributes::OnOff::Id) { - ESP_LOGD(TAG, "Update Bridged Device, ep: %d, cluster: %d, att: %d", endpoint_id, cluster_id, attribute_id); + ESP_LOGD(TAG, "Update Bridged Device, ep: 0x%x, cluster: 0x%lx, att: 0x%lx", endpoint_id, cluster_id, + attribute_id); app_ble_mesh_onoff_set(bridged_device->dev_addr.blemesh_addr, val->val.b); } } } else{ - ESP_LOGE(TAG, "Unable to Update Bridge Device, ep: %d, cluster: %d, att: %d", endpoint_id, cluster_id, attribute_id); + ESP_LOGE(TAG, "Unable to Update Bridge Device, ep: 0x%x, cluster: 0x%lx, att: 0x%lx", endpoint_id, cluster_id, + attribute_id); } return ESP_OK; }