From a080a41b4192fa0ee27ac5e2d8ac2d751a9960c7 Mon Sep 17 00:00:00 2001 From: Jiacheng Guo Date: Wed, 2 Mar 2022 18:04:38 +0800 Subject: [PATCH 1/2] openthread: support automatic RCP update upon boot in border router --- components/openthread/CMakeLists.txt | 11 ++- .../include/esp_openthread_border_router.h | 12 +++ .../openthread/include/esp_openthread_cli.h | 1 - .../include/esp_openthread_rcp_update.h | 50 ---------- .../openthread/include/esp_openthread_types.h | 95 ++++++++++--------- .../openthread/openthread-spinel-config.h | 68 +++++++++++++ .../openthread-core-esp32x-ftd-config.h | 18 +++- 7 files changed, 156 insertions(+), 99 deletions(-) delete mode 100644 components/openthread/include/esp_openthread_rcp_update.h create mode 100644 components/openthread/openthread-spinel-config.h diff --git a/components/openthread/CMakeLists.txt b/components/openthread/CMakeLists.txt index cb22f9d3da..4f1c0178d3 100644 --- a/components/openthread/CMakeLists.txt +++ b/components/openthread/CMakeLists.txt @@ -131,6 +131,10 @@ execute_process( OUTPUT_VARIABLE OPENTHREAD_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) +string(TIMESTAMP OT_BUILD_TIMESTAMP " %Y-%m-%d %H:%M:%S UTC" UTC) +set(OT_FULL_VERSION_STRING + "openthread-esp32/${IDF_VERSION_FOR_OPENTHREAD_PACKAGE}-${OPENTHREAD_VERSION}\; ${CONFIG_IDF_TARGET}\; ${OT_BUILD_TIMESTAMP}") + idf_component_register(SRC_DIRS "${src_dirs}" EXCLUDE_SRCS "${exclude_srcs}" INCLUDE_DIRS "${public_include_dirs}" @@ -152,7 +156,12 @@ if(CONFIG_OPENTHREAD_ENABLED) "OPENTHREAD_CONFIG_FILE=\"openthread-core-esp32x-${CONFIG_FILE_TYPE}-config.h\"" "${device_type}" PRIVATE - "PACKAGE_VERSION=\"${IDF_VERSION_FOR_OPENTHREAD_PACKAGE}-${OPENTHREAD_VERSION}\"") + "PACKAGE_VERSION=\"${IDF_VERSION_FOR_OPENTHREAD_PACKAGE}-${OPENTHREAD_VERSION}\"" + "OPENTHREAD_BUILD_DATETIME=\"${OT_BUILD_TIMESTAMP}\"" + ) + if (CONFIG_OPENTHREAD_RADIO) + file(WRITE ${CMAKE_BINARY_DIR}/rcp_version ${OT_FULL_VERSION_STRING}) + endif() if(CONFIG_OPENTHREAD_ESP_LIB_FROM_INTERNAL_SRC) idf_component_get_property(openthread_port_lib openthread_port COMPONENT_LIB) diff --git a/components/openthread/include/esp_openthread_border_router.h b/components/openthread/include/esp_openthread_border_router.h index 8f77a08838..bce314c735 100644 --- a/components/openthread/include/esp_openthread_border_router.h +++ b/components/openthread/include/esp_openthread_border_router.h @@ -60,6 +60,18 @@ esp_err_t esp_openthread_border_router_deinit(void); */ esp_netif_t *esp_openthread_get_backbone_netif(void); +/** + * @brief Registers the callback for RCP failure. + * + */ +void esp_openthread_register_rcp_failure_handler(esp_openthread_rcp_failure_handler handler); + +/** + * @brief Deinitializes the conneciton to RCP. + * + */ +void esp_openthread_rcp_deinit(); + #ifdef __cplusplus } #endif diff --git a/components/openthread/include/esp_openthread_cli.h b/components/openthread/include/esp_openthread_cli.h index afc1df9ea1..554d0c755c 100644 --- a/components/openthread/include/esp_openthread_cli.h +++ b/components/openthread/include/esp_openthread_cli.h @@ -39,7 +39,6 @@ esp_err_t esp_openthread_cli_input(const char *line); */ void esp_openthread_cli_create_task(void); - #ifdef __cplusplus } #endif diff --git a/components/openthread/include/esp_openthread_rcp_update.h b/components/openthread/include/esp_openthread_rcp_update.h deleted file mode 100644 index 5caa5eafbb..0000000000 --- a/components/openthread/include/esp_openthread_rcp_update.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include "esp_openthread.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief This function triggers an RCP firmware update. - * - * @return - * - ESP_OK - * - ESP_FAIL - * - */ -esp_err_t esp_openthread_rcp_update_start(void); - -/** - * @brief This function writes sequential firmware update data to the RCP. - * - * @param[in] data The firmware data slice - * @param[in] size The data slice size - * - * @return - * - ESP_OK - * - ESP_FAIL - * - */ -esp_err_t esp_openthread_rcp_update_write(uint8_t *data, size_t size); - -/** - * @brief This function commits the firmware update and reboots the RCP. - * - * @return - * - ESP_OK - * - ESP_FAIL - * - */ -esp_err_t esp_openthread_rcp_update_commit(void); - -#ifdef __cplusplus -} -#endif diff --git a/components/openthread/include/esp_openthread_types.h b/components/openthread/include/esp_openthread_types.h index b5337a55af..025dfaa3b2 100644 --- a/components/openthread/include/esp_openthread_types.h +++ b/components/openthread/include/esp_openthread_types.h @@ -6,37 +6,42 @@ #pragma once -#include "hal/uart_types.h" -#include "sys/_stdint.h" -#include "sys/select.h" +#include + +#include + #include "esp_event_base.h" +#include "hal/uart_types.h" #ifdef __cplusplus extern "C" { #endif +#define RCP_FIRMWARE_DIR_SIZE 20 + /** -* @brief OpenThread event declarations -* -*/ -typedef enum { - OPENTHREAD_EVENT_START, /*!< OpenThread stack start */ - OPENTHREAD_EVENT_STOP, /*!< OpenThread stack stop */ - OPENTHREAD_EVENT_IF_UP, /*!< OpenThread network interface up */ - OPENTHREAD_EVENT_IF_DOWN, /*!< OpenThread network interface down */ - OPENTHREAD_EVENT_GOT_IP6, /*!< OpenThread stack added IPv6 address */ - OPENTHREAD_EVENT_LOST_IP6, /*!< OpenThread stack removed IPv6 address */ - OPENTHREAD_EVENT_MULTICAST_GROUP_JOIN, /*!< OpenThread stack joined IPv6 multicast group */ - OPENTHREAD_EVENT_MULTICAST_GROUP_LEAVE, /*!< OpenThread stack left IPv6 multicast group */ - OPENTHREAD_EVENT_TREL_ADD_IP6, /*!< OpenThread stack added TREL IPv6 address */ - OPENTHREAD_EVENT_TREL_REMOVE_IP6, /*!< OpenThread stack removed TREL IPv6 address */ - OPENTHREAD_EVENT_TREL_MULTICAST_GROUP_JOIN, /*!< OpenThread stack joined TREL IPv6 multicast group */ + * @brief OpenThread event declarations + * + */ +typedef enum +{ + OPENTHREAD_EVENT_START, /*!< OpenThread stack start */ + OPENTHREAD_EVENT_STOP, /*!< OpenThread stack stop */ + OPENTHREAD_EVENT_IF_UP, /*!< OpenThread network interface up */ + OPENTHREAD_EVENT_IF_DOWN, /*!< OpenThread network interface down */ + OPENTHREAD_EVENT_GOT_IP6, /*!< OpenThread stack added IPv6 address */ + OPENTHREAD_EVENT_LOST_IP6, /*!< OpenThread stack removed IPv6 address */ + OPENTHREAD_EVENT_MULTICAST_GROUP_JOIN, /*!< OpenThread stack joined IPv6 multicast group */ + OPENTHREAD_EVENT_MULTICAST_GROUP_LEAVE, /*!< OpenThread stack left IPv6 multicast group */ + OPENTHREAD_EVENT_TREL_ADD_IP6, /*!< OpenThread stack added TREL IPv6 address */ + OPENTHREAD_EVENT_TREL_REMOVE_IP6, /*!< OpenThread stack removed TREL IPv6 address */ + OPENTHREAD_EVENT_TREL_MULTICAST_GROUP_JOIN, /*!< OpenThread stack joined TREL IPv6 multicast group */ } esp_openthread_event_t; /** -* @brief OpenThread event base declaration -* -*/ + * @brief OpenThread event base declaration + * + */ ESP_EVENT_DECLARE_BASE(OPENTHREAD_EVENT); /** @@ -44,11 +49,11 @@ ESP_EVENT_DECLARE_BASE(OPENTHREAD_EVENT); * */ typedef struct { - fd_set read_fds; /*!< The read file descriptors */ - fd_set write_fds; /*!< The write file descriptors */ - fd_set error_fds; /*!< The error file descriptors */ - int max_fd; /*!< The max file descriptor */ - struct timeval timeout; /*!< The timeout */ + fd_set read_fds; /*!< The read file descriptors */ + fd_set write_fds; /*!< The write file descriptors */ + fd_set error_fds; /*!< The error file descriptors */ + int max_fd; /*!< The max file descriptor */ + struct timeval timeout; /*!< The timeout */ } esp_openthread_mainloop_context_t; /** @@ -56,28 +61,30 @@ typedef struct { * */ typedef struct { - uart_port_t port; /*!< UART port number */ - uart_config_t uart_config; /*!< UART configuration, see uart_config_t docs */ - int rx_pin; /*!< UART RX pin */ - int tx_pin; /*!< UART TX pin */ + uart_port_t port; /*!< UART port number */ + uart_config_t uart_config; /*!< UART configuration, see uart_config_t docs */ + int rx_pin; /*!< UART RX pin */ + int tx_pin; /*!< UART TX pin */ } esp_openthread_uart_config_t; /** * @brief The radio mode of OpenThread. * */ -typedef enum { - RADIO_MODE_NATIVE = 0x0, /*!< Use the native 15.4 radio */ - RADIO_MODE_UART_RCP = 0x1, /*!< UART connection to a 15.4 capable radio co-processor (RCP) */ - RADIO_MODE_SPI_RCP = 0x2, /*!< SPI connection to a 15.4 capable radio co-processor (RCP) */ +typedef enum +{ + RADIO_MODE_NATIVE = 0x0, /*!< Use the native 15.4 radio */ + RADIO_MODE_UART_RCP = 0x1, /*!< UART connection to a 15.4 capable radio co-processor (RCP) */ + RADIO_MODE_SPI_RCP = 0x2, /*!< SPI connection to a 15.4 capable radio co-processor (RCP) */ } esp_openthread_radio_mode_t; /** * @brief How OpenThread connects to the host. * */ -typedef enum { - HOST_CONNECTION_MODE_NONE = 0x0, /*!< Disable host connection */ +typedef enum +{ + HOST_CONNECTION_MODE_NONE = 0x0, /*!< Disable host connection */ HOST_CONNECTION_MODE_CLI_UART = 0x1, /*!< CLI UART connection to the host */ HOST_CONNECTION_MODE_RCP_UART = 0x2, /*!< RCP UART connection to the host */ } esp_openthread_host_connection_mode_t; @@ -87,8 +94,8 @@ typedef enum { * */ typedef struct { - esp_openthread_radio_mode_t radio_mode; /*!< The radio mode */ - esp_openthread_uart_config_t radio_uart_config; /*!< The uart configuration to RCP */ + esp_openthread_radio_mode_t radio_mode; /*!< The radio mode */ + esp_openthread_uart_config_t radio_uart_config; /*!< The uart configuration to RCP */ } esp_openthread_radio_config_t; /** @@ -96,8 +103,8 @@ typedef struct { * */ typedef struct { - esp_openthread_host_connection_mode_t host_connection_mode; /*!< The host connection mode */ - esp_openthread_uart_config_t host_uart_config; /*!< The uart configuration to host */ + esp_openthread_host_connection_mode_t host_connection_mode; /*!< The host connection mode */ + esp_openthread_uart_config_t host_uart_config; /*!< The uart configuration to host */ } esp_openthread_host_connection_config_t; /** @@ -115,11 +122,13 @@ typedef struct { * */ typedef struct { - esp_openthread_radio_config_t radio_config; /*!< The radio configuration */ - esp_openthread_host_connection_config_t host_config; /*!< The host connection configuration */ - esp_openthread_port_config_t port_config; /*!< The port configuration */ + esp_openthread_radio_config_t radio_config; /*!< The radio configuration */ + esp_openthread_host_connection_config_t host_config; /*!< The host connection configuration */ + esp_openthread_port_config_t port_config; /*!< The port configuration */ } esp_openthread_platform_config_t; +typedef void (*esp_openthread_rcp_failure_handler)(void); + #ifdef __cplusplus } #endif diff --git a/components/openthread/openthread-spinel-config.h b/components/openthread/openthread-spinel-config.h new file mode 100644 index 0000000000..ddf99934f4 --- /dev/null +++ b/components/openthread/openthread-spinel-config.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2020, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes compile-time configuration constants for OpenThread. + */ + +#ifndef OPENTHREAD_SPINEL_CONFIG_H_ +#define OPENTHREAD_SPINEL_CONFIG_H_ + +/** + * @def OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE + * + * Define 1 to enable feeding an OpenThread message to encoder/decoder. + * + */ +#ifndef OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE +#define OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT + * + * Defines the max count of RCP failures allowed to be recovered. + * 0 means to disable RCP failure recovering. + * + */ +#ifndef OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT +#define OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT 0 +#endif + +/** + * @def OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION + * + * Define 1 to call the custom RCP failure handler on RCP failure. + * + */ +#ifndef OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION +#define OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION 0 +#endif + +#endif // OPENTHREAD_SPINEL_CONFIG_H_ diff --git a/components/openthread/private_include/openthread-core-esp32x-ftd-config.h b/components/openthread/private_include/openthread-core-esp32x-ftd-config.h index 01308a9063..f2c9ef9ff8 100644 --- a/components/openthread/private_include/openthread-core-esp32x-ftd-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-ftd-config.h @@ -77,7 +77,6 @@ */ #define OPENTHREAD_CONFIG_COAP_API_ENABLE 1 - /** * @def OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE * @@ -191,7 +190,7 @@ #endif /** - * @def OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE + * @def oPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE * * Define to 1 to enable Backbone Router support. * @@ -200,6 +199,17 @@ #define OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE 1 #endif +/** + * @def OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT + * + * Defines the max count of RCP failures allowed to be recovered. + * 0 means to disable RCP failure recovering. + * + */ +#ifndef OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT +#define OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT 1 +#endif + #endif // CONFIG_OPENTHREAD_BORDER_ROUTER /** @@ -227,7 +237,7 @@ * */ #ifndef OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE -#define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 0 #endif /** @@ -237,7 +247,7 @@ * */ #ifndef OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE -#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 1 +#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 0 #endif /** From ebcd922d5373511df7bff7c1e3943acb12ec5f6a Mon Sep 17 00:00:00 2001 From: Jiacheng Guo Date: Mon, 25 Apr 2022 21:45:19 +0800 Subject: [PATCH 2/2] fix review comments --- components/openthread/CMakeLists.txt | 8 ++- .../include/esp_openthread_border_router.h | 4 +- .../openthread/include/esp_openthread_types.h | 4 +- components/openthread/lib | 2 +- .../openthread/openthread-spinel-config.h | 68 ------------------- .../openthread-core-esp32x-ftd-config.h | 6 +- .../openthread-spinel-config.h | 46 +++++++++++++ examples/openthread/ot_rcp/partitions.csv | 6 +- 8 files changed, 60 insertions(+), 84 deletions(-) delete mode 100644 components/openthread/openthread-spinel-config.h create mode 100644 components/openthread/private_include/openthread-spinel-config.h diff --git a/components/openthread/CMakeLists.txt b/components/openthread/CMakeLists.txt index 4f1c0178d3..00d9b02fe3 100644 --- a/components/openthread/CMakeLists.txt +++ b/components/openthread/CMakeLists.txt @@ -132,8 +132,10 @@ execute_process( ) string(TIMESTAMP OT_BUILD_TIMESTAMP " %Y-%m-%d %H:%M:%S UTC" UTC) -set(OT_FULL_VERSION_STRING - "openthread-esp32/${IDF_VERSION_FOR_OPENTHREAD_PACKAGE}-${OPENTHREAD_VERSION}\; ${CONFIG_IDF_TARGET}\; ${OT_BUILD_TIMESTAMP}") +string(CONCAT OT_FULL_VERSION_STRING + "openthread-esp32/" + "${IDF_VERSION_FOR_OPENTHREAD_PACKAGE}-${OPENTHREAD_VERSION}\; " + "${CONFIG_IDF_TARGET}\; ${OT_BUILD_TIMESTAMP}") idf_component_register(SRC_DIRS "${src_dirs}" EXCLUDE_SRCS "${exclude_srcs}" @@ -159,7 +161,7 @@ if(CONFIG_OPENTHREAD_ENABLED) "PACKAGE_VERSION=\"${IDF_VERSION_FOR_OPENTHREAD_PACKAGE}-${OPENTHREAD_VERSION}\"" "OPENTHREAD_BUILD_DATETIME=\"${OT_BUILD_TIMESTAMP}\"" ) - if (CONFIG_OPENTHREAD_RADIO) + if(CONFIG_OPENTHREAD_RADIO) file(WRITE ${CMAKE_BINARY_DIR}/rcp_version ${OT_FULL_VERSION_STRING}) endif() diff --git a/components/openthread/include/esp_openthread_border_router.h b/components/openthread/include/esp_openthread_border_router.h index bce314c735..33f9244eb7 100644 --- a/components/openthread/include/esp_openthread_border_router.h +++ b/components/openthread/include/esp_openthread_border_router.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -70,7 +70,7 @@ void esp_openthread_register_rcp_failure_handler(esp_openthread_rcp_failure_hand * @brief Deinitializes the conneciton to RCP. * */ -void esp_openthread_rcp_deinit(); +void esp_openthread_rcp_deinit(void); #ifdef __cplusplus } diff --git a/components/openthread/include/esp_openthread_types.h b/components/openthread/include/esp_openthread_types.h index 025dfaa3b2..47caed0f23 100644 --- a/components/openthread/include/esp_openthread_types.h +++ b/components/openthread/include/esp_openthread_types.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -17,8 +17,6 @@ extern "C" { #endif -#define RCP_FIRMWARE_DIR_SIZE 20 - /** * @brief OpenThread event declarations * diff --git a/components/openthread/lib b/components/openthread/lib index 3ec1c7b743..d3446f57c1 160000 --- a/components/openthread/lib +++ b/components/openthread/lib @@ -1 +1 @@ -Subproject commit 3ec1c7b74367a8b31b1d4fadb29a974a4235f2ac +Subproject commit d3446f57c165f4fc1d77fb849c30e0a33b75e6cf diff --git a/components/openthread/openthread-spinel-config.h b/components/openthread/openthread-spinel-config.h deleted file mode 100644 index ddf99934f4..0000000000 --- a/components/openthread/openthread-spinel-config.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2020, The OpenThread Authors. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * @file - * This file includes compile-time configuration constants for OpenThread. - */ - -#ifndef OPENTHREAD_SPINEL_CONFIG_H_ -#define OPENTHREAD_SPINEL_CONFIG_H_ - -/** - * @def OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE - * - * Define 1 to enable feeding an OpenThread message to encoder/decoder. - * - */ -#ifndef OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE -#define OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE 0 -#endif - -/** - * @def OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT - * - * Defines the max count of RCP failures allowed to be recovered. - * 0 means to disable RCP failure recovering. - * - */ -#ifndef OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT -#define OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT 0 -#endif - -/** - * @def OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION - * - * Define 1 to call the custom RCP failure handler on RCP failure. - * - */ -#ifndef OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION -#define OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION 0 -#endif - -#endif // OPENTHREAD_SPINEL_CONFIG_H_ diff --git a/components/openthread/private_include/openthread-core-esp32x-ftd-config.h b/components/openthread/private_include/openthread-core-esp32x-ftd-config.h index f2c9ef9ff8..a6b41853ad 100644 --- a/components/openthread/private_include/openthread-core-esp32x-ftd-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-ftd-config.h @@ -190,7 +190,7 @@ #endif /** - * @def oPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE + * @def OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE * * Define to 1 to enable Backbone Router support. * @@ -237,7 +237,7 @@ * */ #ifndef OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE -#define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 0 +#define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 1 #endif /** @@ -247,7 +247,7 @@ * */ #ifndef OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE -#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 0 +#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 1 #endif /** diff --git a/components/openthread/private_include/openthread-spinel-config.h b/components/openthread/private_include/openthread-spinel-config.h new file mode 100644 index 0000000000..2911ee3df6 --- /dev/null +++ b/components/openthread/private_include/openthread-spinel-config.h @@ -0,0 +1,46 @@ +/* + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * This file includes compile-time configuration constants for OpenThread. + */ + +#ifndef OPENTHREAD_SPINEL_CONFIG_H_ +#define OPENTHREAD_SPINEL_CONFIG_H_ + +/** + * @def OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE + * + * Define 1 to enable feeding an OpenThread message to encoder/decoder. + * + */ +#ifndef OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE +#define OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT + * + * Defines the max count of RCP failures allowed to be recovered. + * 0 means to disable RCP failure recovering. + * + */ +#ifndef OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT +#define OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT 0 +#endif + +/** + * @def OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION + * + * Define 1 to call the custom RCP failure handler on RCP failure. + * + */ +#ifndef OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION +#define OPENTHREAD_SPINEL_CONFIG_RCP_CUSTOM_RESTORATION 0 +#endif + +#endif // OPENTHREAD_SPINEL_CONFIG_H_ diff --git a/examples/openthread/ot_rcp/partitions.csv b/examples/openthread/ot_rcp/partitions.csv index 520796efa2..738122467a 100644 --- a/examples/openthread/ot_rcp/partitions.csv +++ b/examples/openthread/ot_rcp/partitions.csv @@ -1,8 +1,6 @@ # Name, Type, SubType, Offset, Size, Flags # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap nvs, data, nvs, 0x9000, 0x6000, -otadata, data, ota, , 0x2000, phy_init, data, phy, , 0x1000, -ot_storage, data, 0x3a, , 0x2000, -ota_0, app, ota_0, , 900K, -ota_1, app, ota_1, , 900K, +factory, app, factory, 0x10000, 1M, +ot_storage, data, 0x3a, , 0x2000,