From b3aa5ad76dbe0843f2aacce31c5a4f816a43e8c9 Mon Sep 17 00:00:00 2001 From: Bob Date: Sat, 8 Nov 2025 19:57:11 +0000 Subject: [PATCH] Initial commit: ESP32 iperf implementation --- .gitignore | 34 +++++ CMakeLists.txt | 6 + README.md | 118 ++++++++++++++ main/CMakeLists.txt | 2 + main/Kconfig.projbuild | 21 +++ main/iperf.c | 339 +++++++++++++++++++++++++++++++++++++++++ main/iperf.h | 59 +++++++ main/main.c | 241 +++++++++++++++++++++++++++++ 8 files changed, 820 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 README.md create mode 100644 main/CMakeLists.txt create mode 100644 main/Kconfig.projbuild create mode 100644 main/iperf.c create mode 100644 main/iperf.h create mode 100644 main/main.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c172444 --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +# Build artifacts +build/ +sdkconfig +sdkconfig.old +*.pyc +*.o +*.a +*.so +*.bin +*.elf +*.map + +# IDE +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# Dependencies +dependencies/ +managed_components/ + +# Python +__pycache__/ +*.py[cod] +*$py.class +.Python +venv/ +env/ + +# OS +.DS_Store +Thumbs.db diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..091079e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,6 @@ +# The following lines of boilerplate have to be in your project's +# CMakeLists in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.16) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(esp32-iperf) diff --git a/README.md b/README.md new file mode 100644 index 0000000..6426f9d --- /dev/null +++ b/README.md @@ -0,0 +1,118 @@ +# ESP32 iperf + +Network performance testing tool for ESP32 based on iperf2. + +## Features + +- TCP and UDP client/server modes +- Bandwidth measurement +- Packet loss detection (UDP) +- Console-based control interface +- WiFi station mode support + +## Hardware Requirements + +- ESP32 development board +- WiFi network + +## Software Requirements + +- ESP-IDF v5.0 or later +- iperf2 or iperf3 for testing with PC + +## Building + +1. Set up ESP-IDF environment: +```bash +. $HOME/Code/esp32/esp-idf/export.sh +``` + +2. Configure WiFi credentials: +```bash +idf.py menuconfig +``` +Navigate to "ESP32 iperf Configuration" and set your SSID and password. + +3. Build the project: +```bash +idf.py build +``` + +4. Flash to ESP32: +```bash +idf.py -p /dev/ttyUSB0 flash monitor +``` + +## Usage + +### TCP Server Mode +On ESP32: +``` +iperf> iperf -s +``` + +On PC: +```bash +iperf -c +``` + +### TCP Client Mode +On PC: +```bash +iperf -s +``` + +On ESP32: +``` +iperf> iperf -c +``` + +### UDP Mode +Add `-u` flag for UDP testing: +``` +iperf> iperf -s -u +iperf> iperf -c -u +``` + +### Options +- `-s` : Run as server +- `-c ` : Run as client, connecting to server IP +- `-u` : Use UDP instead of TCP +- `-p ` : Port number (default: 5001) +- `-t