diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6a5b2ad..802e9fd 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -57,8 +57,6 @@ pre_commit: - cd $ESP_THREAD_BR_PATH/examples/basic_thread_border_router - rm -rf CMakeLists.txt - cp ${CI_TOOLS_PATH}/basic_thread_border_router.cmake CMakeLists.txt - - rm -rf sdkconfig.defaults - - cp ${CI_TOOLS_PATH}/sdkconfig.br.basic sdkconfig.defaults - idf.py build .build_local_components: &build_local_components @@ -72,8 +70,6 @@ pre_commit: - cp ${CI_TOOLS_PATH}/idf_component_local.yml main/idf_component.yml - rm -rf CMakeLists.txt - cp ${CI_TOOLS_PATH}/basic_thread_border_router.cmake CMakeLists.txt - - rm -rf sdkconfig.defaults - - cp ${CI_TOOLS_PATH}/sdkconfig.br.basic sdkconfig.defaults - idf.py build .build_idf_example_ot_br: &build_idf_example_ot_br diff --git a/README.md b/README.md index 16ed388..3213b06 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ ESP-THREAD-BR is the official [ESP Thread Border Router](https://openthread.io/g The SDK is built on top of [ESP-IDF](https://github.com/espressif/esp-idf) and [OpenThread](https://github.com/openthread/openthread). The OpenThread port and ESP Border Router implementation is provided as pre-built library in ESP-IDF. +It is recommended to use ESP-IDF [v5.3.1](https://github.com/espressif/esp-idf/tree/v5.3.1) with this SDK. + # Hardware Platforms ## Wi-Fi based Thread Border Router diff --git a/components/esp_ot_cli_extension/CMakeLists.txt b/components/esp_ot_cli_extension/CMakeLists.txt index c54cf78..b88e474 100644 --- a/components/esp_ot_cli_extension/CMakeLists.txt +++ b/components/esp_ot_cli_extension/CMakeLists.txt @@ -28,18 +28,16 @@ if(CONFIG_OPENTHREAD_RCP_COMMAND) endif() set(include "include") -if(CONFIG_OPENTHREAD_CLI_WIFI) - list(APPEND include $ENV{IDF_PATH}/examples/common_components/protocol_examples_common/include) -endif() + idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "${include}" PRIV_REQUIRES lwip openthread iperf esp_netif esp_wifi http_parser esp_http_client esp_coex heap mbedtls nvs_flash esp_eth) -if (CONFIG_OPENTHREAD_CLI_OTA) - idf_component_optional_requires(PUBLIC esp_br_http_ota) +if(CONFIG_OPENTHREAD_CLI_OTA) + idf_component_optional_requires(PRIVATE esp_br_http_ota) endif() -if (CONFIG_OPENTHREAD_RCP_COMMAND) +if(CONFIG_OPENTHREAD_RCP_COMMAND) idf_component_optional_requires(PRIVATE esp_rcp_update) endif() diff --git a/components/esp_ot_cli_extension/idf_component.yml b/components/esp_ot_cli_extension/idf_component.yml index 8d91b1c..24e0555 100644 --- a/components/esp_ot_cli_extension/idf_component.yml +++ b/components/esp_ot_cli_extension/idf_component.yml @@ -1,4 +1,4 @@ -version: "1.2.4" +version: "1.2.5" description: Espressif OpenThread CLI Extension url: https://github.com/espressif/esp-thread-br/tree/main/components/esp_ot_cli_extension dependencies: diff --git a/docs/en/dev-guide/build_and_run.rst b/docs/en/dev-guide/build_and_run.rst index 0ee190a..89b97fe 100644 --- a/docs/en/dev-guide/build_and_run.rst +++ b/docs/en/dev-guide/build_and_run.rst @@ -9,9 +9,11 @@ This document contains instructions on building the images for ESP Thread Border Clone the `esp-idf `_ and the `esp-thread-br `_ repository. +It is recommended to use ESP-IDF `v5.3.1 `_ with this SDK. + .. code-block:: bash - git clone -b v5.1.3 --recursive https://github.com/espressif/esp-idf.git + git clone -b v5.3.1 --recursive https://github.com/espressif/esp-idf.git .. code-block:: bash @@ -85,6 +87,22 @@ For any other customized settings, you can configure the project in menuconfig. idf.py menuconfig +.. note:: + + `LWIP_IPV6_NUM_ADDRESSES` configuration is fixed in the border router library, it was changed from 8 to 12 since IDF v5.3.1 release. Please update this configuration based on the following table: + + +--------------------+-------------------------+ + | IDF Versions | LWIP_IPV6_NUM_ADDRESSES | + +--------------------+-------------------------+ + | v5.1.4 and earlier | 8 | + +--------------------+-------------------------+ + | v5.2.2 and earlier | 8 | + +--------------------+-------------------------+ + | v5.3.0 | 8 | + +--------------------+-------------------------+ + | v5.3.1 and later | 12 | + +--------------------+-------------------------+ + 2.1.3.1. Wi-Fi based Thread Border Router ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/examples/basic_thread_border_router/CMakeLists.txt b/examples/basic_thread_border_router/CMakeLists.txt index 35ac22c..977822e 100644 --- a/examples/basic_thread_border_router/CMakeLists.txt +++ b/examples/basic_thread_border_router/CMakeLists.txt @@ -2,13 +2,5 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -# (Not part of the boilerplate) -# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. -set(EXTRA_COMPONENT_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/../common - ${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_br_http_ota - ${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_ot_br_server -) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(esp_ot_br) diff --git a/examples/basic_thread_border_router/README.md b/examples/basic_thread_border_router/README.md index 066f967..4db6ecc 100644 --- a/examples/basic_thread_border_router/README.md +++ b/examples/basic_thread_border_router/README.md @@ -14,25 +14,30 @@ Please refer to [ESP Thread Border Router Hardware](../../README.md##Hardware-Pl Refer to [ESP-IDF Get Started](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/get-started/index.html). -Note that it is recommended to use the latest [esp-idf](https://github.com/espressif/esp-idf). +It is recommended to use ESP-IDF [v5.3.1](https://github.com/espressif/esp-idf/tree/v5.3.1) with this example. ### Configure the project -ESP32-S3 is the host SoC on ESP Thread Border Router Board, so set target to esp32s3: +ESP32-S3 is the host SoC on ESP Thread Border Router Board, esp32s3 is selected by default in the example. Set the other target with this command: ``` -idf.py set-target esp32s3 +idf.py set-target ``` -The host could be pre-configured with `OPENTHREAD_RADIO_SPINEL_UART` or `OPENTHREAD_RADIO_SPINEL_SPI` to select UART or SPI to access the Radio Co-Processor. - -If the `OPENTHREAD_BR_AUTO_START` option is enabled, the device will connect to the configured Wi-Fi and form Thread network automatically then act as the border router. +`LWIP_IPV6_NUM_ADDRESSES` configuration is fixed in the border router library, it was changed from 8 to 12 since IDF v5.3.1 release. Please update this configuration based on the following table: -The Wi-Fi network's ssid and psk needs to be pre-configured with `EXAMPLE_WIFI_SSID` and `EXAMPLE_WIFI_PASSWORD`. +| IDF Versions | LWIP_IPV6_NUM_ADDRESSES | +|:-----------------------:|:-------------------------:| +| v5.1.4 and earlier | 8 | +| v5.2.2 and earlier | 8 | +| v5.3.0 | 8 | +| v5.3.1 and later | 12 | -Note that in this mode, the device will first attempt to use the Wi-Fi SSID and password stored in NVS. If no Wi-Fi information is stored, it will then use the `EXAMPLE_WIFI_SSID` and `EXAMPLE_WIFI_PASSWORD` from menuconfig. +The host could be pre-configured with `OPENTHREAD_RADIO_SPINEL_UART` or `OPENTHREAD_RADIO_SPINEL_SPI` to select UART or SPI to access the Radio Co-Processor. -The Thread network parameters could be pre-configured with `OPENTHREAD_NETWORK_xx` options. +If the `OPENTHREAD_BR_AUTO_START` option is enabled, the device will connect to the configured Wi-Fi and form Thread network automatically then act as the border router: +- The Wi-Fi network's ssid and psk needs to be pre-configured with `EXAMPLE_WIFI_SSID` and `EXAMPLE_WIFI_PASSWORD`. In this mode, the device will first attempt to use the Wi-Fi SSID and password stored in NVS. If no Wi-Fi information is stored, it will then use the pre-configured ssid and psk. +- The Thread network parameters could be pre-configured with `OPENTHREAD_NETWORK_xx` options. If the `OPENTHREAD_BR_START_WEB` option is enabled, [ESP Thread Border Router Web Server](../../components/esp_ot_br_server/README.md) will be provided to configure and query Thread network via a Web GUI. diff --git a/examples/basic_thread_border_router/main/idf_component.yml b/examples/basic_thread_border_router/main/idf_component.yml index 4866ba1..0c11903 100644 --- a/examples/basic_thread_border_router/main/idf_component.yml +++ b/examples/basic_thread_border_router/main/idf_component.yml @@ -7,9 +7,15 @@ dependencies: espressif/esp_rcp_update: version: "~1.3.0" override_path: '../../../components/esp_rcp_update' + esp_br_http_ota: + path: ../../../components/esp_br_http_ota + esp_ot_br_server: + path: ../../../components/esp_ot_br_server + thread_border_router: + path: ../../common/thread_border_router + protocol_examples_common: + path: ${IDF_PATH}/examples/common_components/protocol_examples_common + ## Required IDF version idf: - version: ">=4.1.0" - # # Put list of dependencies here - protocol_examples_common: - path: ${IDF_PATH}/examples/common_components/protocol_examples_common \ No newline at end of file + version: ">=5.1.0" diff --git a/examples/basic_thread_border_router/sdkconfig.defaults b/examples/basic_thread_border_router/sdkconfig.defaults index c8cba94..32a2245 100644 --- a/examples/basic_thread_border_router/sdkconfig.defaults +++ b/examples/basic_thread_border_router/sdkconfig.defaults @@ -60,7 +60,10 @@ CONFIG_AUTO_UPDATE_RCP=y # lwIP # CONFIG_LWIP_IPV6_FORWARD=y -CONFIG_LWIP_IPV6_NUM_ADDRESSES=8 + +# Use 12 with IDF v5.3.1 and later, and use 8 with earlier versions of IDF. +CONFIG_LWIP_IPV6_NUM_ADDRESSES=12 + CONFIG_LWIP_MULTICAST_PING=y CONFIG_LWIP_NETIF_STATUS_CALLBACK=y CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y diff --git a/tools/ci/basic_thread_border_router.cmake b/tools/ci/basic_thread_border_router.cmake index eb325c8..453afe7 100644 --- a/tools/ci/basic_thread_border_router.cmake +++ b/tools/ci/basic_thread_border_router.cmake @@ -8,14 +8,5 @@ set(ENV{EXTRA_CFLAGS} "-Werror -Werror=deprecated-declarations -Werror=unused-va set(ENV{EXTRA_CXXFLAGS} "-Werror -Werror=deprecated-declarations -Werror=unused-variable \ -Werror=unused-but-set-variable -Werror=unused-function") -# (Not part of the boilerplate) -# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. -set(EXTRA_COMPONENT_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/../common - ${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_br_http_ota - ${CMAKE_CURRENT_SOURCE_DIR}/../../components/esp_ot_br_server - $ENV{IDF_PATH}/examples/common_components/protocol_examples_common -) - include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(esp_ot_br) diff --git a/tools/ci/idf_component_local.yml b/tools/ci/idf_component_local.yml index daf1950..b8e394b 100644 --- a/tools/ci/idf_component_local.yml +++ b/tools/ci/idf_component_local.yml @@ -2,12 +2,21 @@ dependencies: espressif/mdns: "^1.0.0" espressif/esp_ot_cli_extension: - path: "$ESP_THREAD_BR_PATH/components/esp_ot_cli_extension" + path: ${ESP_THREAD_BR_PATH}/components/esp_ot_cli_extension espressif/esp_rcp_update: - path: "$ESP_THREAD_BR_PATH/components/esp_rcp_update" + path: ${ESP_THREAD_BR_PATH}/components/esp_rcp_update espressif/esp-serial-flasher: "~0.0.0" + esp_br_http_ota: + path: ${ESP_THREAD_BR_PATH}/components/esp_br_http_ota + esp_ot_br_server: + path: ${ESP_THREAD_BR_PATH}/components/esp_ot_br_server + thread_border_router: + path: ${ESP_THREAD_BR_PATH}/examples/common/thread_border_router + protocol_examples_common: + path: ${IDF_PATH}/examples/common_components/protocol_examples_common + ## Required IDF version idf: version: ">=4.1.0" - # # Put list of dependencies here + diff --git a/tools/ci/sdkconfig.br.basic b/tools/ci/sdkconfig.br.basic deleted file mode 100644 index f9f1576..0000000 --- a/tools/ci/sdkconfig.br.basic +++ /dev/null @@ -1,106 +0,0 @@ -# ESP32-S3 is the host SoC on ESP-Thread-Border-Router board -CONFIG_IDF_TARGET="esp32s3" - -# -# Serial flasher config -# -CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y -# end of Serial flasher config - -# -# Partition Table -# -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_OFFSET=0x8000 -CONFIG_PARTITION_TABLE_MD5=y -# end of Partition Table - -# -# Compiler options -# -CONFIG_COMPILER_OPTIMIZATION_SIZE=y - -# -# Newlib -# -CONFIG_NEWLIB_NANO_FORMAT=y - -# -# mbedTLS -# - -CONFIG_MBEDTLS_CMAC_C=y -CONFIG_MBEDTLS_SSL_PROTO_DTLS=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECJPAKE=y -# end of TLS Key Exchange Methods - -CONFIG_MBEDTLS_ECJPAKE_C=y -# end of mbedTLS - -# -# OpenThread -# -CONFIG_OPENTHREAD_ENABLED=y -CONFIG_OPENTHREAD_BORDER_ROUTER=y -CONFIG_OPENTHREAD_CLI_OTA=y -CONFIG_OPENTHREAD_RCP_COMMAND=y -CONFIG_OPENTHREAD_CONSOLE_TYPE_USB_SERIAL_JTAG=y -CONFIG_OPENTHREAD_RADIO_SPINEL_UART=y -# end of OpenThread - -# -# OpenThread Border Router Example -# -CONFIG_AUTO_UPDATE_RCP=y -# end of OpenThread Border Router Example - -# -# lwIP -# -CONFIG_LWIP_IPV6_FORWARD=y -CONFIG_LWIP_IPV6_NUM_ADDRESSES=12 -CONFIG_LWIP_MULTICAST_PING=y -CONFIG_LWIP_NETIF_STATUS_CALLBACK=y -CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y -CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y -CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM=y -CONFIG_LWIP_IPV6_AUTOCONFIG=y -CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM=y -CONFIG_LWIP_FORCE_ROUTER_FORWARDING=y -# end of lwIP - -# -# mDNS -# -CONFIG_MDNS_MULTIPLE_INSTANCE=y -# end of mDNS - -# -# ESP System Settings -# -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3584 -# end of ESP System Settings - -# -# ESP Border Router Board Kit -# -CONFIG_ESP_BR_BOARD_DEV_KIT=y -CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y -# end of ESP Border Router Board Kit - -# -# Etherenet -# -CONFIG_EXAMPLE_USE_W5500=y -CONFIG_EXAMPLE_ETH_SPI_HOST=2 -CONFIG_EXAMPLE_ETH_SPI_SCLK_GPIO=21 -CONFIG_EXAMPLE_ETH_SPI_MOSI_GPIO=45 -CONFIG_EXAMPLE_ETH_SPI_MISO_GPIO=38 -CONFIG_EXAMPLE_ETH_SPI_CS_GPIO=41 -CONFIG_EXAMPLE_ETH_SPI_CLOCK_MHZ=36 -CONFIG_EXAMPLE_ETH_SPI_INT_GPIO=39 -CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=40 -CONFIG_EXAMPLE_ETH_PHY_ADDR=1 -# end of Etherenet