Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/esp8266: enable lwIP for ESP8266 #12949

Merged
merged 3 commits into from
Dec 17, 2019

Conversation

gschorcht
Copy link
Contributor

Contribution description

This PR provides very small changes that make it possible to use pkg/lwip also with ESP8266.

Background

The SDK interface of the WiFi module uses the lwIP's pbuf structure for packets sent to and received from the WiFi interface. For compatibility reasons with the binary SDK libraries, module esp_wifi has to include the SDK lwIP pbuf header and can't use that from pkg/lwip.

To avoid compilation errors, all settings in pkg/lwIP that are also defined by SDK lwIP header files have to be undefined in esp_wifi.

Tests

The following tests were executed:

  • tests/lwip
    • IPv6 works with esp_wifi
    • IPv4 version is not available.
  • tests/lwip_sock_ip
    • IPv6 works without esp_wifi
    • IPv6 fails with esp_wifi in test_sock_ip_recv6__socket with EAGAIN
    • IPv4 works with esp_wifi
  • tests/lwip_sock_tcp
    • IPv6 works with esp_wifi
    • IPv6 fails in test_tcp_connect6__EINVAL_netif with 0 (means sock_tcp_connect success)
    • IPv4 fails in test_tcp_connect6__EINVAL_netif with 0 (means sock_tcp_connect success)
  • tests/lwip_sock_udp
    • IPv6 works with esp_wifi
    • IPv6 hangs in test_sock_udp_recv6__socketed but the node is reachable with ping
    • IPv4 works with esp_wifi

It seems that the tests 'fail' when they are executed with enabled esp_wifi because of the existence of the real network interface or because packets injected to the test device are interfered by incoming packets from the WiFi interface.

Testing procedure

Flash tests/lwip with enabled module esp_wifi on any ESP8266 board

USEMODULE=esp_wifi CFLAGS='-DESP_WIFI_SSID=\"ssid\" -DESP_WIFI_PASS=\"pass\"'\
make BOARD=esp8266-esp-12x -C tests/lwip flash term

and execute ifconfig on ESP8266 node and ping the node from any machine in the LAN.

Issues/PRs references

Depends on PR #12948.
Depends on PR #12903 for IPv4.

@gschorcht gschorcht added Area: cpu Area: CPU/MCU ports Area: pkg Area: External package ports Platform: ESP Platform: This PR/issue effects ESP-based platforms State: waiting for other PR State: The PR requires another PR to be merged first Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation labels Dec 14, 2019
@benpicco benpicco removed the State: waiting for other PR State: The PR requires another PR to be merged first label Dec 16, 2019
@benpicco
Copy link
Contributor

Please squash.

@gschorcht
Copy link
Contributor Author

gschorcht commented Dec 16, 2019

@benpicco Can I push another small fix of lwip_ip4 for esp_wifi with this PR we have missed in PR #12903?

@benpicco
Copy link
Contributor

Sure, go ahead.

@gschorcht gschorcht force-pushed the cpu/esp8266/enable_lwip branch from d6aa5b8 to 921ab40 Compare December 16, 2019 15:21
@gschorcht
Copy link
Contributor Author

I had to rebase to push 921ab40. All other commits are unchanged.

Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are looking good - please squash.

@gschorcht gschorcht force-pushed the cpu/esp8266/enable_lwip branch from 921ab40 to ddc34b4 Compare December 17, 2019 07:29
@gschorcht gschorcht added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Dec 17, 2019
@gschorcht
Copy link
Contributor Author

@benpicco Squashed.

@benpicco benpicco merged commit cfeb2a3 into RIOT-OS:master Dec 17, 2019
@fjmolinas fjmolinas added this to the Release 2020.01 milestone Dec 17, 2019
@gschorcht
Copy link
Contributor Author

Thanks for reviewing and merging.

@gschorcht gschorcht deleted the cpu/esp8266/enable_lwip branch December 17, 2019 12:54
@gschorcht
Copy link
Contributor Author

@kb2ma lwip_ipv4 is now available for ESP8266. Together with PR #12966 and #12965 it should be possible to use test/lwip with ESP8266 and IPv4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ESP Platform: This PR/issue effects ESP-based platforms Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants