From ebcd922d5373511df7bff7c1e3943acb12ec5f6a Mon Sep 17 00:00:00 2001 From: Jiacheng Guo Date: Mon, 25 Apr 2022 21:45:19 +0800 Subject: [PATCH] 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,