feat(esp_eth): removed disable of C5 and P4 from examples .build-test-rules

Updated examples to be able to build for C5 and P4.

Added Ethernet support for static_ip example.
This commit is contained in:
Ondrej Kosta 2024-06-07 10:43:14 +02:00
parent 43066f2e37
commit dd81b56fb6
54 changed files with 391 additions and 217 deletions

View File

@ -4,9 +4,9 @@ examples/ethernet/basic:
enable:
- if: INCLUDE_DEFAULT == 1
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [esp32c61] IDF-9298
reason: not supported yet # TODO: [esp32c61] IDF-9298
disable_test:
- if: IDF_TARGET not in ["esp32"]
temporary: true
@ -21,9 +21,9 @@ examples/ethernet/basic:
examples/ethernet/enc28j60:
disable:
- if: IDF_TARGET in ["esp32p4", "esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: target esp32p4, esp32c5 is not supported yet # TODO: [ESP32P4] IDF-8073 [ESP32C5] IDF-8697, [esp32c61] IDF-9298
reason: not supported yet # TODO: [esp32c61] IDF-9298
depends_components:
- esp_eth
- esp_netif
@ -34,9 +34,9 @@ examples/ethernet/enc28j60:
examples/ethernet/iperf:
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [esp32c61] IDF-9298
reason: not supported yet # TODO: [esp32c61] IDF-9298
disable_test:
- if: IDF_TARGET not in ["esp32"]
temporary: true

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Ethernet Example
(See the README.md file in the upper level 'examples' directory for more information about examples.)

View File

@ -12,7 +12,7 @@ from pytest_embedded import Dut
pytest.param('default_ip101', marks=[pytest.mark.ethernet_router]),
pytest.param('default_dm9051', marks=[pytest.mark.eth_dm9051]),
], indirect=True)
def test_esp_eth_basic_dm9051(
def test_esp_eth_basic(
dut: Dut
) -> None:
# wait for ip received

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ENC28J60 Example
(See the README.md file in the upper level 'examples' directory for more information about examples.)

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Ethernet iperf Example

View File

@ -15,9 +15,9 @@ examples/protocols/esp_http_client:
enable:
- if: INCLUDE_DEFAULT == 1 or IDF_TARGET == "linux"
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported yet # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET not in ["esp32", "linux"]
depends_filepatterns:
@ -26,9 +26,9 @@ examples/protocols/esp_http_client:
examples/protocols/esp_local_ctrl:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32h2", "esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32h2", "esp32c61"]
temporary: true
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported yet # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET not in ["esp32", "esp32c3", "esp32s3"]
reason: only test on these targets
@ -39,9 +39,9 @@ examples/protocols/esp_local_ctrl:
examples/protocols/http_request:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported yet # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -49,9 +49,9 @@ examples/protocols/http_request:
examples/protocols/http_server:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported yet # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET not in ["esp32", "esp32c3", "esp32s3"]
reason: only test on these targets
@ -61,9 +61,11 @@ examples/protocols/http_server:
examples/protocols/http_server/captive_portal:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32h2", "esp32p4", "esp32c5", "esp32c61"]
- if: SOC_WIFI_SUPPORTED != 1
reason: WiFi is required
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported yet # TODO: IDF-8076 [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported yet # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -73,18 +75,18 @@ examples/protocols/http_server/captive_portal:
examples/protocols/http_server/restful_server:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32h2", "esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32h2", "esp32c61"]
temporary: true
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported yet # TODO: [ESP32C61] IDF-9298
depends_filepatterns:
- components/esp_http_server/**/*
examples/protocols/http_server/ws_echo_server:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported yet # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -96,9 +98,9 @@ examples/protocols/https_mbedtls:
enable:
- if: INCLUDE_DEFAULT == 1 or IDF_TARGET == "linux"
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported yet # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -108,7 +110,7 @@ examples/protocols/https_request:
disable:
- if: IDF_TARGET in ["esp32h2", "esp32p4", "esp32c5", "esp32c61"]
temporary: true
reason: not supported on h2, p4 and c5 # TODO: IDF-9076 (H2) [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on h2, p4 and c5 # TODO: IDF-9076 (H2/P4/C5), [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -116,9 +118,9 @@ examples/protocols/https_request:
examples/protocols/https_server/simple:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported yet # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET not in ["esp32", "esp32c3", "esp32s3"]
reason: only test on these targets
@ -129,9 +131,9 @@ examples/protocols/https_server/simple:
examples/protocols/https_server/wss_server:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported yet # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -141,9 +143,9 @@ examples/protocols/https_server/wss_server:
examples/protocols/https_x509_bundle:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported yet # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported yet # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -153,18 +155,18 @@ examples/protocols/https_x509_bundle:
examples/protocols/icmp_echo:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32p4", "esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on p4 and c5 # TODO: [ESP32-C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32-C5] IDF-8697, [ESP32C61] IDF-9298
disable_test:
- if: SOC_WIFI_SUPPORTED != 1
examples/protocols/l2tap:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32p4", "esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on p4 and c5 # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -183,25 +185,25 @@ examples/protocols/modbus:
examples/protocols/mqtt:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on c5 # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32C61] IDF-9298
depends_filepatterns:
- components/mqtt/**/*
examples/protocols/mqtt/custom_outbox:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on c5 # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32C61] IDF-9298
examples/protocols/mqtt/ssl:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on c5 # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -216,9 +218,9 @@ examples/protocols/mqtt/ssl_ds:
examples/protocols/mqtt/tcp:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on c5 # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -226,9 +228,9 @@ examples/protocols/mqtt/tcp:
examples/protocols/mqtt/ws:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on c5 # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -236,9 +238,9 @@ examples/protocols/mqtt/ws:
examples/protocols/mqtt/wss:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on c5 # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -246,9 +248,9 @@ examples/protocols/mqtt/wss:
examples/protocols/mqtt5:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on c5 # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
reason: only test on esp32
@ -256,9 +258,9 @@ examples/protocols/mqtt5:
examples/protocols/smtp_client:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32p4", "esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on p4 and c5 # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32C61] IDF-9298
examples/protocols/sntp:
<<: *default_dependencies
@ -270,13 +272,12 @@ examples/protocols/sntp:
examples/protocols/sockets:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32p4", "esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on p4 and c5 # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32C61] IDF-9298
disable_test:
- if: SOC_WIFI_SUPPORTED != 1
examples/protocols/sockets/non_blocking:
<<: *default_dependencies
disable_test:
@ -290,14 +291,17 @@ examples/protocols/sockets/tcp_client:
- if: SOC_WIFI_SUPPORTED != 1
# linux target won't work with CONFIG_EXAMPLE_SOCKET_IP_INPUT_STDIN=y
disable:
- if: IDF_TARGET in ["esp32p4", "esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on p4 and c5 # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32C61] IDF-9298
examples/protocols/static_ip:
<<: *default_dependencies
disable:
- if: IDF_TARGET in ["esp32h2"]
- if: IDF_TARGET in ["esp32p4", "esp32c5", "esp32c61"]
- if: IDF_TARGET in ["esp32c61"]
temporary: true
reason: not supported on p4 and c5 # TODO: [ESP32C5] IDF-8697, [ESP32C61] IDF-9298
reason: not supported on c61 # TODO: [ESP32C61] IDF-9298
disable_test:
- if: IDF_TARGET != "esp32"
temporary: true
reason: lack of runners

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | Linux |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | ----- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | Linux |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | ----- |
# ESP HTTP Client Example
See the README.md file in the upper level 'examples' directory for more information about examples.

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ESP Local Control using HTTPS server

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# HTTP Request Example

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# HTTP server advanced tests

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Async Requests Handlers HTTPD Server Example

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
# Captive Portal Example

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Simple HTTP File Server Example

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# HTTPD Server Persistent Sockets Example

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# HTTP Restful API Server Example

View File

@ -1,9 +1,9 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Simple HTTPD Server Example
The Example consists of HTTPD server demo with demostration of URI handling :
The Example consists of HTTPD server demo with demonstration of URI handling :
1. URI \hello for GET command returns "Hello World!" message
2. URI \echo for POST command echoes back the POSTed message
@ -39,7 +39,7 @@ See the Getting Started Guide for full steps to configure and use ESP-IDF to bui
* run the test script : "python scripts/client.py \<IP\> \<port\> \<MSG\>"
* the provided test script first does a GET \hello and displays the response
* the script does a POST to \echo with the user input \<MSG\> and displays the response
* or use curl (asssuming IP is 192.168.43.130):
* or use curl (assuming IP is 192.168.43.130):
1. "curl 192.168.43.130:80/hello" - tests the GET "\hello" handler
2. "curl -X POST --data-binary @anyfile 192.168.43.130:80/echo > tmpfile"
* "anyfile" is the file being sent as request body and "tmpfile" is where the body of the response is saved

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Websocket echo server

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | Linux |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | ----- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | Linux |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | ----- |
# HTTP connection with TLS support using mbedTLS

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# HTTP server with SSL support using OpenSSL

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# HTTP Websocket server with SSL support

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# HTTPS x509 Bundle Example

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ICMP Echo-Reply (Ping) example

View File

@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import os
import pytest
@ -39,6 +38,7 @@ def _run_test(dut: Dut) -> None:
@pytest.mark.esp32s2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c5
@pytest.mark.esp32c6
@pytest.mark.wifi_ap
def test_protocols_icmp_echo(dut: Dut) -> None:

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ESP-NETIF L2 TAP Interface Example
(See the README.md file in the upper level 'examples' directory for more information about examples.)

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ESP-MQTT custom outbox sample application
(See the README.md file in the upper level 'examples' directory for more information about examples.)

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ESP-MQTT SSL Sample application

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ESP-MQTT SSL Sample application (mutual authentication)

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ESP-MQTT SSL example with PSK verification

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ESP-MQTT sample application
(See the README.md file in the upper level 'examples' directory for more information about examples.)

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ESP-MQTT MQTT over Websocket

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ESP-MQTT MQTT over WSS Sample application
(See the README.md file in the upper level 'examples' directory for more information about examples.)

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ESP-MQTT sample application
(See the README.md file in the upper level 'examples' directory for more information about examples.)

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# SMTP Client Example

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# ICMPv6 Ping example

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# TCP Client example

View File

@ -1,12 +1,13 @@
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import logging
import socket
import pytest
from common_test_methods import (get_env_config_variable, get_host_ip4_by_dest_ip, get_host_ip6_by_dest_ip,
get_my_interface_by_dest_ip)
from common_test_methods import get_env_config_variable
from common_test_methods import get_host_ip4_by_dest_ip
from common_test_methods import get_host_ip6_by_dest_ip
from common_test_methods import get_my_interface_by_dest_ip
from pytest_embedded import Dut
try:
@ -26,6 +27,7 @@ PORT = 3333
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c5
@pytest.mark.esp32c6
@pytest.mark.wifi_router
def test_examples_tcp_client_ipv4(dut: Dut) -> None:

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Multiple Ethernet Example
(See the README.md file in the upper level 'examples' directory for more information about examples.)
@ -66,12 +66,12 @@ I (2315) wifi:pm start, type: 1
I (2325) wifi:AP's beacon interval = 102400 us, DTIM period = 3
I (3125) esp_netif_handlers: example_connect: sta ip: 192.168.2.15, mask: 255.255.255.0, gw: 192.168.2.1
I (3125) example_connect: Interface desciption example_connect: sta
I (3125) example_connect: Interface description example_connect: sta
I (3135) example_connect: Interface "example_connect: sta" got IPv4 address: 192.168.2.15
I (3625) example_connect: Interface "example_connect: sta" got IPv6 address: fe80:0000:0000:0000:32ae:a4ff:fec6:b4f8, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (4825) example_connect: Ethernet Link Up
I (5625) esp_netif_handlers: example_connect: eth ip: 192.168.32.148, mask: 255.255.252.0, gw: 192.168.32.3
I (5625) example_connect: Interface desciption example_connect: eth
I (5625) example_connect: Interface description example_connect: eth
I (5635) example_connect: Interface "example_connect: eth" got IPv4 address: 192.168.32.148
I (6625) example_connect: Interface "example_connect: eth" got IPv6 address: fe80:0000:0000:0000:32ae:a4ff:fec6:b4fb, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (6625) example_connect: Connected to example_connect: eth

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# TCP Server example

View File

@ -1,12 +1,12 @@
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import logging
import time
import netifaces
import pytest
from common_test_methods import get_env_config_variable, get_my_interface_by_dest_ip
from common_test_methods import get_env_config_variable
from common_test_methods import get_my_interface_by_dest_ip
from pytest_embedded import Dut
try:
@ -27,6 +27,7 @@ MESSAGE = 'Data to ESP'
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c5
@pytest.mark.esp32c6
@pytest.mark.wifi_router
def test_examples_tcp_server_ipv4(dut: Dut) -> None:

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# TCP TRANSPORT Client example

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# UDP Client example
@ -91,7 +91,7 @@ Choose connection capabilities in `Example Connection Configuration` menu:
* If you want to connect lwIP network interface to the host system networking, set `EXAMPLE_CONNECT_LWIP_TAPIF`.
* Configure the interface address information (IP address, GW address and netmask).
* Create a host network interface named `tap0` of *TAP* type. You can use the `./make_tap_netif` script located in the `tapif_io` component directory.
* Optionally set input or output packet loss rate to simulate loosing data of physical interfaces.
* Optionally set input or output packet loss rate to simulate losing data of physical interfaces.
* Note about the host side networking:
* This example uses static IP address configured in `tapif_io` component configuration.
* Use the IP ranges that do not overlap with any other IP range of the host system.

View File

@ -1,12 +1,13 @@
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import logging
import socket
import pytest
from common_test_methods import (get_env_config_variable, get_host_ip4_by_dest_ip, get_host_ip6_by_dest_ip,
get_my_interface_by_dest_ip)
from common_test_methods import get_env_config_variable
from common_test_methods import get_host_ip4_by_dest_ip
from common_test_methods import get_host_ip6_by_dest_ip
from common_test_methods import get_my_interface_by_dest_ip
from pexpect.exceptions import TIMEOUT
from pytest_embedded import Dut
@ -28,6 +29,7 @@ MAX_RETRIES = 3
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c5
@pytest.mark.esp32c6
@pytest.mark.wifi_router
def test_examples_udp_client_ipv4(dut: Dut) -> None:

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# UDP Multicast Example

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# UDP Server example

View File

@ -1,10 +1,10 @@
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import logging
import pytest
from common_test_methods import get_env_config_variable, get_my_interface_by_dest_ip
from common_test_methods import get_env_config_variable
from common_test_methods import get_my_interface_by_dest_ip
from pytest_embedded import Dut
try:
@ -26,6 +26,7 @@ MAX_RETRIES = 3
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c5
@pytest.mark.esp32c6
@pytest.mark.wifi_router
def test_examples_udp_server_ipv4(dut: Dut) -> None:

View File

@ -1,10 +1,11 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# WiFi station example
# Static IP Example
(See the README.md file in the upper level 'examples' directory for more information about examples.)
This example demonstrates how to configure static IP address on ESP32 family devices.
## How to use example
@ -14,9 +15,13 @@
idf.py menuconfig
```
Set following parameters under Example Configuration Options:
At first, decide if you want to use the example with WiFi or Ethernet network interface. Note that the example is designed to support only one network interface at a time.
* Set `WiFi SSID` and `WiFi Password` and `Maximal retry` under Example Configuration Options.
* Set `WiFi SSID` and `WiFi Password` and `Maximal retry` under `WiFi Example Configuration` Options, if you are planning to use WiFi to connect to the network.
* Or configure `Internal EMAC` or `SPI Ethernet` under `Ethernet Configuration` Option based on your actual hardware configuration, if you are planning to use Ethernet to connect to the network.
Set following parameters under `Example Configuration` Options which are common for both network interfaces:
* Set `Static IP address` of your device static IP.
@ -54,7 +59,7 @@ I (573) system_api: read default base MAC address from EFUSE
I (603) wifi:wifi firmware version: 6b2834e
I (603) wifi:wifi certification version: v7.0
I (603) wifi:config NVS flash: enabled
I (603) wifi:config nano formating: disabled
I (603) wifi:config nano formatting: disabled
I (613) wifi:Init data frame dynamic rx buffer num: 32
I (613) wifi:Init management frame dynamic rx buffer num: 32
I (623) wifi:Init management short buffer num: 32

View File

@ -1,22 +1,9 @@
menu "Example Configuration"
config EXAMPLE_WIFI_SSID
string "WiFi SSID"
default "myssid"
help
SSID (network name) for the example to connect to.
config EXAMPLE_WIFI_PASSWORD
string "WiFi Password"
default "mypassword"
help
WiFi password (WPA or WPA2) for the example to use.
config EXAMPLE_MAXIMUM_RETRY
int "Maximum retry"
default 5
help
Set the Maximum retry to avoid station reconnecting to the AP unlimited when the AP is really inexistent.
# Hidden variable to get configuration of Component for Ethernet Initialization
config EXAMPLE_USE_ETH
bool
default y if ETHERNET_INTERNAL_SUPPORT || ETHERNET_SPI_SUPPORT
default n
config EXAMPLE_STATIC_IP_ADDR
string "Static IP address"
@ -79,3 +66,33 @@ menu "Example Configuration"
help
Set domain name for DNS test
endmenu
menu "WiFi Example Configuration"
config EXAMPLE_USE_WIFI
depends on SOC_WIFI_SUPPORTED
bool "Use WiFi"
default y
help
Select to use WiFi as network interface in the example.
if EXAMPLE_USE_WIFI
config EXAMPLE_WIFI_SSID
string "WiFi SSID"
default "myssid"
help
SSID (network name) for the example to connect to.
config EXAMPLE_WIFI_PASSWORD
string "WiFi Password"
default "mypassword"
help
WiFi password (WPA or WPA2) for the example to use.
config EXAMPLE_MAXIMUM_RETRY
int "Maximum retry"
default 5
help
Set the Maximum retry to avoid station reconnecting to the AP unlimited when the AP is really
inexistent.
endif # EXAMPLE_WIFI
endmenu

View File

@ -0,0 +1,5 @@
dependencies:
idf:
version: '>=5.0'
espressif/ethernet_init:
version: '*'

View File

@ -12,19 +12,30 @@
#include "freertos/event_groups.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_eth.h"
#include "ethernet_init.h"
#include "esp_event.h"
#include "esp_log.h"
#include <netdb.h>
#include "nvs_flash.h"
#if CONFIG_EXAMPLE_USE_WIFI && CONFIG_EXAMPLE_USE_ETH
#error "The example is designed to be used only with one Network interface. Either select WiFi or Ethernet."
#endif
#if !(CONFIG_EXAMPLE_USE_WIFI || CONFIG_EXAMPLE_USE_ETH)
#error "Incomplete network interface configuration. Either select WiFi or Ethernet."
#endif
/* The examples use configuration that you can set via project configuration menu
If you'd rather not, just change the below entries to strings with
the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid"
*/
#ifdef CONFIG_EXAMPLE_USE_WIFI
#define EXAMPLE_WIFI_SSID CONFIG_EXAMPLE_WIFI_SSID
#define EXAMPLE_WIFI_PASS CONFIG_EXAMPLE_WIFI_PASSWORD
#define EXAMPLE_MAXIMUM_RETRY CONFIG_EXAMPLE_MAXIMUM_RETRY
#endif // EXAMPLE_USE_WIFI
#define EXAMPLE_STATIC_IP_ADDR CONFIG_EXAMPLE_STATIC_IP_ADDR
#define EXAMPLE_STATIC_NETMASK_ADDR CONFIG_EXAMPLE_STATIC_NETMASK_ADDR
#define EXAMPLE_STATIC_GW_ADDR CONFIG_EXAMPLE_STATIC_GW_ADDR
@ -34,23 +45,23 @@
#else
#define EXAMPLE_MAIN_DNS_SERVER CONFIG_EXAMPLE_STATIC_DNS_SERVER_MAIN
#define EXAMPLE_BACKUP_DNS_SERVER CONFIG_EXAMPLE_STATIC_DNS_SERVER_BACKUP
#endif
#endif // CONFIG_EXAMPLE_STATIC_DNS_AUTO
#ifdef CONFIG_EXAMPLE_STATIC_DNS_RESOLVE_TEST
#define EXAMPLE_RESOLVE_DOMAIN CONFIG_EXAMPLE_STATIC_RESOLVE_DOMAIN
#endif
#endif // CONFIG_EXAMPLE_STATIC_DNS_RESOLVE_TEST
/* FreeRTOS event group to signal when we are connected*/
static EventGroupHandle_t s_wifi_event_group;
static EventGroupHandle_t s_network_event_group;
/* The event group allows multiple bits for each event, but we only care about two events:
* - we are connected to the AP with an IP
* - we failed to connect after the maximum amount of retries */
#define WIFI_CONNECTED_BIT BIT0
#define WIFI_FAIL_BIT BIT1
#define CONNECTED_BIT BIT0
#define WIFI_FAIL_BIT BIT1
#define ETH_CONNECTION_TMO_MS (10000)
static const char *TAG = "static_ip";
static int s_retry_num = 0;
static esp_err_t example_set_dns_server(esp_netif_t *netif, uint32_t addr, esp_netif_dns_type_t type)
{
if (addr && (addr != IPADDR_NONE)) {
@ -82,9 +93,12 @@ static void example_set_static_ip(esp_netif_t *netif)
ESP_ERROR_CHECK(example_set_dns_server(netif, ipaddr_addr(EXAMPLE_BACKUP_DNS_SERVER), ESP_NETIF_DNS_BACKUP));
}
static void event_handler(void* arg, esp_event_base_t event_base,
#ifdef CONFIG_EXAMPLE_USE_WIFI
static void wifi_event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
{
static int s_retry_num = 0;
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
esp_wifi_connect();
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_CONNECTED) {
@ -95,24 +109,28 @@ static void event_handler(void* arg, esp_event_base_t event_base,
s_retry_num++;
ESP_LOGI(TAG, "retry to connect to the AP");
} else {
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
xEventGroupSetBits(s_network_event_group, WIFI_FAIL_BIT);
}
ESP_LOGI(TAG,"connect to the AP fail");
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data;
ESP_LOGI(TAG, "static ip:" IPSTR, IP2STR(&event->ip_info.ip));
s_retry_num = 0;
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
xEventGroupSetBits(s_network_event_group, CONNECTED_BIT);
}
}
void wifi_init_sta(void)
static void wifi_init_sta(void)
{
s_wifi_event_group = xEventGroupCreate();
//Initialize NVS
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta();
assert(sta_netif);
@ -124,12 +142,12 @@ void wifi_init_sta(void)
esp_event_handler_instance_t instance_got_ip;
ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT,
ESP_EVENT_ANY_ID,
&event_handler,
&wifi_event_handler,
sta_netif,
&instance_any_id));
ESP_ERROR_CHECK(esp_event_handler_instance_register(IP_EVENT,
IP_EVENT_STA_GOT_IP,
&event_handler,
&wifi_event_handler,
sta_netif,
&instance_got_ip));
@ -138,7 +156,7 @@ void wifi_init_sta(void)
.ssid = EXAMPLE_WIFI_SSID,
.password = EXAMPLE_WIFI_PASS,
/* Setting a password implies station will connect to all security modes including WEP/WPA.
* However these modes are deprecated and not advisable to be used. Incase your Access point
* However these modes are deprecated and not advisable to be used. In case your Access point
* doesn't support WPA2, these mode can be enabled by commenting below line */
.threshold.authmode = WIFI_AUTH_WPA2_PSK,
},
@ -149,17 +167,17 @@ void wifi_init_sta(void)
ESP_LOGI(TAG, "wifi_init_sta finished.");
/* Waiting until either the connection is established (WIFI_CONNECTED_BIT) or connection failed for the maximum
* number of re-tries (WIFI_FAIL_BIT). The bits are set by event_handler() (see above) */
EventBits_t bits = xEventGroupWaitBits(s_wifi_event_group,
WIFI_CONNECTED_BIT | WIFI_FAIL_BIT,
/* Waiting until either the connection is established (CONNECTED_BIT) or connection failed for the maximum
* number of re-tries (WIFI_FAIL_BIT). The bits are set by wifi_event_handler() (see above) */
EventBits_t bits = xEventGroupWaitBits(s_network_event_group,
CONNECTED_BIT | WIFI_FAIL_BIT,
pdFALSE,
pdFALSE,
portMAX_DELAY);
/* xEventGroupWaitBits() returns the bits before the call returned, hence we can test which event actually
* happened. */
if (bits & WIFI_CONNECTED_BIT) {
if (bits & CONNECTED_BIT) {
ESP_LOGI(TAG, "connected to ap SSID:%s password:%s",
EXAMPLE_WIFI_SSID, EXAMPLE_WIFI_PASS);
} else if (bits & WIFI_FAIL_BIT) {
@ -168,6 +186,91 @@ void wifi_init_sta(void)
} else {
ESP_LOGE(TAG, "UNEXPECTED EVENT");
}
/* The event will not be processed after unregister */
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, instance_got_ip));
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, instance_any_id));
vEventGroupDelete(s_network_event_group);
}
#endif // CONFIG_EXAMPLE_USE_WIFI
#ifdef CONFIG_EXAMPLE_USE_ETH
static void eth_event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
{
if (event_base == ETH_EVENT && event_id == ETHERNET_EVENT_CONNECTED) {
example_set_static_ip(arg);
} else if (event_base == IP_EVENT && event_id == IP_EVENT_ETH_GOT_IP) {
ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data;
ESP_LOGI(TAG, "static ip:" IPSTR, IP2STR(&event->ip_info.ip));
xEventGroupSetBits(s_network_event_group, CONNECTED_BIT);
}
}
static void eth_init(void)
{
uint8_t eth_port_cnt = 0;
esp_eth_handle_t *eth_handles;
ESP_ERROR_CHECK(ethernet_init_all(&eth_handles, &eth_port_cnt));
if (eth_port_cnt > 1) {
ESP_LOGW(TAG, "multiple Ethernet devices detected, the first initialized is to be used!");
}
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
esp_netif_t *eth_netif = esp_netif_new(&cfg);
// Attach Ethernet driver to TCP/IP stack
ESP_ERROR_CHECK(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handles[0])));
esp_event_handler_instance_t instance_any_id;
esp_event_handler_instance_t instance_got_ip;
ESP_ERROR_CHECK(esp_event_handler_instance_register(ETH_EVENT,
ESP_EVENT_ANY_ID,
&eth_event_handler,
eth_netif,
&instance_any_id));
ESP_ERROR_CHECK(esp_event_handler_instance_register(IP_EVENT,
IP_EVENT_ETH_GOT_IP,
&eth_event_handler,
eth_netif,
&instance_got_ip));
ESP_ERROR_CHECK(esp_eth_start(eth_handles[0]));
/* Waiting until the connection is established (CONNECTED_BIT). The bits are set by eth_event_handler() (see above) */
EventBits_t bits = xEventGroupWaitBits(s_network_event_group,
CONNECTED_BIT,
pdFALSE,
pdFALSE,
pdMS_TO_TICKS(ETH_CONNECTION_TMO_MS));
/* xEventGroupWaitBits() returns the bits before the call returned, hence we can test which event actually
* happened. */
if (!(bits & CONNECTED_BIT)) {
ESP_LOGE(TAG, "Ethernet link not connected in defined timeout of %d msecs", ETH_CONNECTION_TMO_MS);
}
/* The event will not be processed after unregister */
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, instance_got_ip));
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(ETH_EVENT, ESP_EVENT_ANY_ID, instance_any_id));
vEventGroupDelete(s_network_event_group);
}
#endif // CONFIG_EXAMPLE_USE_ETH
void app_main(void)
{
s_network_event_group = xEventGroupCreate();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
#ifdef CONFIG_EXAMPLE_USE_WIFI
wifi_init_sta();
#endif
#ifdef CONFIG_EXAMPLE_USE_ETH
eth_init();
#endif
#ifdef CONFIG_EXAMPLE_STATIC_DNS_RESOLVE_TEST
struct addrinfo *address_info;
struct addrinfo hints;
@ -175,6 +278,7 @@ void wifi_init_sta(void)
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
ESP_LOGI(TAG, "Trying to resolve IP address for domain: '%s'", EXAMPLE_RESOLVE_DOMAIN);
int res = getaddrinfo(EXAMPLE_RESOLVE_DOMAIN, NULL, &hints, &address_info);
if (res != 0 || address_info == NULL) {
ESP_LOGE(TAG, "couldn't get hostname for :%s: "
@ -192,22 +296,4 @@ void wifi_init_sta(void)
#endif
}
#endif
/* The event will not be processed after unregister */
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, instance_got_ip));
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, instance_any_id));
vEventGroupDelete(s_wifi_event_group);
}
void app_main(void)
{
//Initialize NVS
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
wifi_init_sta();
}

View File

@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
import pytest
from pytest_embedded import Dut
@pytest.mark.esp32
@pytest.mark.eth_ip101
@pytest.mark.parametrize('config', [
'default_ip101',
], indirect=True)
def test_static_ip(
dut: Dut
) -> None:
dut.expect(r'Resolved IPv4 address: (\d+\.\d+\.\d+\.\d+)')

View File

@ -0,0 +1,28 @@
CONFIG_IDF_TARGET="esp32"
# CONFIG_EXAMPLE_USE_WIFI is not set
CONFIG_EXAMPLE_USE_ETH=y
# Below static IP configuration is compatible with "VM Ethernet CI runner" environment
CONFIG_EXAMPLE_STATIC_IP_ADDR="120.140.1.2"
CONFIG_EXAMPLE_STATIC_NETMASK_ADDR="255.255.255.0"
CONFIG_EXAMPLE_STATIC_GW_ADDR="120.140.1.1"
# CONFIG_EXAMPLE_STATIC_DNS_AUTO is not set
CONFIG_EXAMPLE_STATIC_DNS_MANUAL=y
CONFIG_EXAMPLE_STATIC_DNS_SERVER_MAIN="8.8.8.8"
CONFIG_EXAMPLE_STATIC_DNS_SERVER_BACKUP="8.8.4.4"
CONFIG_EXAMPLE_STATIC_DNS_RESOLVE_TEST=y
CONFIG_EXAMPLE_STATIC_RESOLVE_DOMAIN="www.espressif.com"
CONFIG_ETHERNET_INTERNAL_SUPPORT=y
CONFIG_ETHERNET_PHY_IP101=y
# CONFIG_ETHERNET_PHY_RTL8201 is not set
# CONFIG_ETHERNET_PHY_LAN87XX is not set
# CONFIG_ETHERNET_PHY_DP83848 is not set
# CONFIG_ETHERNET_PHY_KSZ80XX is not set
CONFIG_ETHERNET_MDC_GPIO=23
CONFIG_ETHERNET_MDIO_GPIO=18
CONFIG_ETHERNET_PHY_RST_GPIO=5
CONFIG_ETHERNET_PHY_ADDR=1
# CONFIG_ETHERNET_SPI_SUPPORT is not set

View File

@ -0,0 +1,2 @@
# CONFIG_ETHERNET_INTERNAL_SUPPORT is not set
# CONFIG_ETHERNET_SPI_SUPPORT is not set

View File

@ -0,0 +1,3 @@
CONFIG_IDF_TARGET="esp32h2"
CONFIG_ETHERNET_SPI_SUPPORT=y

View File

@ -0,0 +1,3 @@
CONFIG_IDF_TARGET="esp32p4"
CONFIG_ETHERNET_INTERNAL_SUPPORT=y