Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp32: update esp_rcp_update version to 1.2.0 #35114

Merged
merged 6 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/esp32/components/chip/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies:
- if: "target != esp32h2"

espressif/esp_rcp_update:
version: "1.0.3"
version: "1.2.0"
rules:
- if: "idf_version >=5.0"

Expand Down
4 changes: 2 additions & 2 deletions examples/platform/esp32/common/Esp32ThreadInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void ESPOpenThreadInit()
.host_config = ESP_OPENTHREAD_DEFAULT_HOST_CONFIG(),
.port_config = ESP_OPENTHREAD_DEFAULT_PORT_CONFIG(),
};
#ifdef CONFIG_OPENTHREAD_BORDER_ROUTER
#if defined(CONFIG_OPENTHREAD_BORDER_ROUTER) && defined(CONFIG_AUTO_UPDATE_RCP)
esp_vfs_spiffs_conf_t rcp_fw_conf = {
.base_path = "/rcp_fw", .partition_label = "rcp_fw", .max_files = 10, .format_if_mount_failed = false
};
Expand All @@ -53,7 +53,7 @@ void ESPOpenThreadInit()
}
esp_rcp_update_config_t rcp_update_config = ESP_OPENTHREAD_RCP_UPDATE_CONFIG();
openthread_init_br_rcp(&rcp_update_config);
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER && CONFIG_AUTO_UPDATE_RCP
set_openthread_platform_config(&config);

if (ThreadStackMgr().InitThreadStack() != CHIP_NO_ERROR)
Expand Down
4 changes: 2 additions & 2 deletions examples/platform/esp32/common/Esp32ThreadInit.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
.storage_partition_name = "nvs", .netif_queue_size = 10, .task_queue_size = 10, \
}

#ifdef CONFIG_OPENTHREAD_BORDER_ROUTER
#if defined(CONFIG_OPENTHREAD_BORDER_ROUTER) && defined(CONFIG_AUTO_UPDATE_RCP)
#include <esp_rcp_update.h>
#define RCP_FIRMWARE_DIR "/spiffs/ot_rcp"

Expand All @@ -93,7 +93,7 @@
.rcp_type = RCP_TYPE_ESP32H2_UART, .uart_rx_pin = 17, .uart_tx_pin = 18, .uart_port = 1, .uart_baudrate = 115200, \
.reset_pin = 7, .boot_pin = 8, .update_baudrate = 460800, .firmware_dir = "/rcp_fw/ot_rcp", .target_chip = ESP32H2_CHIP, \
}
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER && CONFIG_AUTO_UPDATE_RCP

#endif // CONFIG_OPENTHREAD_ENABLED

Expand Down
92 changes: 0 additions & 92 deletions examples/thread-br-app/esp32/create_ota_image.py

This file was deleted.

10 changes: 0 additions & 10 deletions examples/thread-br-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,6 @@ idf_component_register(PRIV_INCLUDE_DIRS

get_filename_component(CHIP_ROOT ${CMAKE_SOURCE_DIR}/third_party/connectedhomeip REALPATH)

idf_build_get_property(python PYTHON)
add_custom_target(rcp_image_generation ALL
COMMAND ${python} ${CMAKE_CURRENT_SOURCE_DIR}/../create_ota_image.py
--rcp-build-dir $ENV{IDF_PATH}/examples/openthread/ot_rcp/build
--target-file ${CMAKE_CURRENT_BINARY_DIR}/spiffs_image/ot_rcp_0/rcp_image
)
spiffs_create_partition_image(rcp_fw ${CMAKE_CURRENT_BINARY_DIR}/spiffs_image FLASH_IN_PROJECT
DEPENDS rcp_image_generation)


include("${CHIP_ROOT}/build/chip/esp32/esp32_codegen.cmake")

chip_app_component_codegen("${CHIP_ROOT}/examples/thread-br-app/thread-br-common/thread-br-app.matter")
Expand Down
5 changes: 4 additions & 1 deletion examples/thread-br-app/esp32/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n
# LWIP
CONFIG_LWIP_IPV6_FORWARD=y
CONFIG_LWIP_IPV6_AUTOCONFIG=y
CONFIG_LWIP_IPV6_NUM_ADDRESSES=8
CONFIG_LWIP_IPV6_NUM_ADDRESSES=12
CONFIG_LWIP_MULTICAST_PING=y
CONFIG_LWIP_NETIF_STATUS_CALLBACK=y
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
Expand All @@ -67,6 +67,9 @@ CONFIG_OPENTHREAD_DNS_CLIENT=n
CONFIG_OPENTHREAD_BORDER_ROUTER=y
CONFIG_THREAD_NETWORK_COMMISSIONING_DRIVER=n

# Auto update RCP firmware
CONFIG_AUTO_UPDATE_RCP=y

# Use platform mDNS
CONFIG_USE_MINIMAL_MDNS=n

Expand Down
3 changes: 1 addition & 2 deletions src/platform/ESP32/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
esp_netif_t * netif = esp_netif_next(NULL);
NetworkInterface * head = NULL;
uint8_t ipv6_addr_count = 0;
esp_ip6_addr_t ip6_addr[kMaxIPv6AddrCount];
esp_ip6_addr_t ip6_addr[LWIP_IPV6_NUM_ADDRESSES];
if (netif == NULL)
{
ChipLogError(DeviceLayer, "Failed to get network interfaces");
Expand Down Expand Up @@ -253,7 +253,6 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
#endif // !defined(CONFIG_DISABLE_IPV4)

static_assert(kMaxIPv6AddrCount <= UINT8_MAX, "Count might not fit in ipv6_addr_count");
static_assert(ArraySize(ip6_addr) >= LWIP_IPV6_NUM_ADDRESSES, "Not enough space for our addresses.");
auto addr_count = esp_netif_get_all_ip6(ifa, ip6_addr);
if (addr_count < 0)
{
Expand Down
14 changes: 6 additions & 8 deletions src/platform/ESP32/OpenthreadLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static void ot_task_worker(void * context)
vTaskDelete(NULL);
}

#ifdef CONFIG_OPENTHREAD_BORDER_ROUTER
#if defined(CONFIG_OPENTHREAD_BORDER_ROUTER) && defined(CONFIG_AUTO_UPDATE_RCP)

static constexpr size_t kRcpVersionMaxSize = 100;
static const char * TAG = "RCP_UPDATE";
Expand Down Expand Up @@ -183,16 +183,14 @@ static void try_update_ot_rcp(const esp_openthread_platform_config_t * config)
esp_restart();
}
}
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER

static void rcp_failure_handler(void)
{
#ifdef CONFIG_OPENTHREAD_BORDER_ROUTER
esp_rcp_mark_image_unusable();
try_update_ot_rcp(s_platform_config);
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER
esp_rcp_reset();
}
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER && CONFIG_AUTO_UPDATE_RCP

esp_err_t set_openthread_platform_config(esp_openthread_platform_config_t * config)
{
Expand All @@ -208,7 +206,7 @@ esp_err_t set_openthread_platform_config(esp_openthread_platform_config_t * conf
return ESP_OK;
}

#ifdef CONFIG_OPENTHREAD_BORDER_ROUTER
#if defined(CONFIG_OPENTHREAD_BORDER_ROUTER) && defined(CONFIG_AUTO_UPDATE_RCP)
esp_err_t openthread_init_br_rcp(const esp_rcp_update_config_t * update_config)
{
esp_err_t err = ESP_OK;
Expand All @@ -219,7 +217,7 @@ esp_err_t openthread_init_br_rcp(const esp_rcp_update_config_t * update_config)
esp_openthread_register_rcp_failure_handler(rcp_failure_handler);
return err;
}
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER && CONFIG_AUTO_UPDATE_RCP

esp_err_t openthread_init_stack(void)
{
Expand All @@ -236,9 +234,9 @@ esp_err_t openthread_init_stack(void)
assert(s_platform_config);
// Initialize the OpenThread stack
ESP_ERROR_CHECK(esp_openthread_init(s_platform_config));
#ifdef CONFIG_OPENTHREAD_BORDER_ROUTER
#if defined(CONFIG_OPENTHREAD_BORDER_ROUTER) && defined(CONFIG_AUTO_UPDATE_RCP)
try_update_ot_rcp(s_platform_config);
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER && CONFIG_AUTO_UPDATE_RCP
#ifdef CONFIG_OPENTHREAD_CLI
esp_openthread_matter_cli_init();
cli_command_transmit_task();
Expand Down
6 changes: 3 additions & 3 deletions src/platform/ESP32/OpenthreadLauncher.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

#include <esp_err.h>
#include <esp_openthread_types.h>
#include <esp_rcp_update.h>
#include <lib/core/CHIPError.h>
#include <memory>

#ifdef CONFIG_OPENTHREAD_BORDER_ROUTER
#if defined(CONFIG_OPENTHREAD_BORDER_ROUTER) && defined(CONFIG_AUTO_UPDATE_RCP)
#include <esp_rcp_update.h>
esp_err_t openthread_init_br_rcp(const esp_rcp_update_config_t * update_config);
#endif
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER && CONFIG_AUTO_UPDATE_RCP
esp_err_t set_openthread_platform_config(esp_openthread_platform_config_t * config);
esp_err_t openthread_init_stack(void);
esp_err_t openthread_launch_task(void);
Expand Down
Loading