feat(openthread): migrate iperf to use iperf-cmd component

This commit is contained in:
Tan Yan Quan
2026-01-08 15:18:27 +08:00
parent 8c7d8254a4
commit f18228020f
8 changed files with 38 additions and 9 deletions
+2 -1
View File
@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: CC0-1.0 * SPDX-License-Identifier: CC0-1.0
* *
@@ -97,6 +97,7 @@ void app_main(void)
#if CONFIG_OPENTHREAD_CLI #if CONFIG_OPENTHREAD_CLI
ot_console_start(); ot_console_start();
ot_register_external_commands();
#endif #endif
#if CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE #if CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE
+2 -1
View File
@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: CC0-1.0 * SPDX-License-Identifier: CC0-1.0
* *
@@ -58,6 +58,7 @@ void app_main(void)
#if CONFIG_OPENTHREAD_CLI #if CONFIG_OPENTHREAD_CLI
ot_console_start(); ot_console_start();
ot_register_external_commands();
#endif #endif
static esp_openthread_config_t config = { static esp_openthread_config_t config = {
@@ -15,5 +15,5 @@ endif()
idf_component_register( idf_component_register(
SRCS "${srcs}" SRCS "${srcs}"
INCLUDE_DIRS "include" INCLUDE_DIRS "include"
PRIV_REQUIRES console cmd_system esp_coex openthread PRIV_REQUIRES console cmd_system esp_coex openthread iperf-cmd iperf
) )
@@ -9,6 +9,16 @@ menu "Config for OpenThread Examples"
If enabled, the Openthread Device will create or connect to Thread network with pre-configured If enabled, the Openthread Device will create or connect to Thread network with pre-configured
network parameters automatically. Otherwise, user need to configure Thread via CLI command manually. network parameters automatically. Otherwise, user need to configure Thread via CLI command manually.
menu "External Console Commands"
config OPENTHREAD_IPERF_CMD_ENABLE
bool "Enable iperf command"
depends on OPENTHREAD_FTD || OPENTHREAD_MTD
default y
help
If enabled, iperf will be registered and available as a console command.
This allows network performance testing using iperf over the Thread network.
endmenu # External Console Commands
menu "External coexist wire type and pin config" menu "External coexist wire type and pin config"
depends on ESP_COEX_EXTERNAL_COEXIST_ENABLE depends on ESP_COEX_EXTERNAL_COEXIST_ENABLE
@@ -1,4 +1,5 @@
## IDF Component Manager Manifest File ## IDF Component Manager Manifest File
dependencies: dependencies:
espressif/iperf-cmd: "^1.0.0"
cmd_system: cmd_system:
path: ${IDF_PATH}/examples/system/console/advanced/components/cmd_system path: ${IDF_PATH}/examples/system/console/advanced/components/cmd_system
@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: CC0-1.0 * SPDX-License-Identifier: CC0-1.0
* *
@@ -61,3 +61,9 @@ void ot_console_start(void);
* *
*/ */
void ot_network_auto_start(void); void ot_network_auto_start(void);
/**
* @brief Register external system commands (e.g., iperf).
*
*/
void ot_register_external_commands(void);
@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: CC0-1.0 * SPDX-License-Identifier: CC0-1.0
* *
@@ -18,6 +18,10 @@
#include "esp_console.h" #include "esp_console.h"
#include "cmd_system.h" #include "cmd_system.h"
#if CONFIG_OPENTHREAD_IPERF_CMD_ENABLE
#include "iperf_cmd.h"
#endif
void ot_console_start(void) void ot_console_start(void)
{ {
esp_console_repl_t *repl = NULL; esp_console_repl_t *repl = NULL;
@@ -43,6 +47,12 @@ void ot_console_start(void)
#error Unsupported console type #error Unsupported console type
#endif #endif
ESP_ERROR_CHECK(esp_console_start_repl(repl)); ESP_ERROR_CHECK(esp_console_start_repl(repl));
}
register_system();
void ot_register_external_commands(void)
{
register_system();
#if CONFIG_OPENTHREAD_IPERF_CMD_ENABLE
iperf_cmd_register_iperf();
#endif
} }
@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: CC0-1.0 * SPDX-License-Identifier: CC0-1.0
* *
@@ -44,7 +44,6 @@
#include "esp_ot_cli_extension.h" #include "esp_ot_cli_extension.h"
#endif // CONFIG_OPENTHREAD_CLI_ESP_EXTENSION #endif // CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
#define TAG "ot_esp_trel" #define TAG "ot_esp_trel"
void app_main(void) void app_main(void)
@@ -68,6 +67,7 @@ void app_main(void)
#if CONFIG_OPENTHREAD_CLI #if CONFIG_OPENTHREAD_CLI
ot_console_start(); ot_console_start();
ot_register_external_commands();
#endif #endif
static esp_openthread_config_t config = { static esp_openthread_config_t config = {