Skip to content

Incompatibility issue with lwip napt on ESP32-S3 using Arduino framework #8193

Closed
@Gspohu

Description

@Gspohu

Board

ESP32-S3

Device Description

DevKitC

Hardware Configuration

Out of context

Version

v2.0.9

IDE Name

PlatformIO

Operating System

Kubuntu Linux 22.04

Flash frequency

1000

PSRAM enabled

yes

Upload speed

115200

Description

Hello @espressif team,

I have been developing a connected object project that is running successfully on an ESP32-S3 using the Arduino framework. I am now trying to add a functionality that involves lwip napt for a WiFi extender.

I tried prototyping this in Arduino but encountered an issue where I get the following error messages:

undefined reference to `ip_napt_enable_no'
undefined reference to `ip_napt_enable'

Interestingly, I had no such problems while implementing the same functionality with espidf.
For me, it is not possible to recode the whole firmware on espidf.

I have made several attempts to troubleshoot this issue to no avail:

  • I tried including lwip as a "lib" or "component" in my project directory.
  • I attempted to use Arduino as a component of espidf, but this was quite challenging and resulted in a performance drop in my Arduino code. Plus, the lwip version remained as the Arduino one.
  • I tried replacing the lwip directory in the Arduino framework with the espidf one. As expected, this didn't work because Arduino uses precompiled libraries. I would love to understand the rationale behind this choice if anyone can help.
  • I manipulated my platformio.ini to add the necessary compilation flags, but this was unsuccessful because, again, Arduino uses precompiled libraries.
  • I also tried this: platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.5.3/platform-espressif32-2.0.5.3.zip. However, it crashed my platformio, and I had to reset the software.

The issues I encountered seem to be similar to the ones described here, but I couldn't find a feasible solution:

I noticed there was supposed to be a fix in the Arduino lib builder (espressif/esp32-arduino-lib-builder#69), but it seems to be forgotten at the moment.

Interestingly, I found an implementation for ESP8266 (https://github.com/martin-ger/lwip_nat_arduino) but couldn't find an equivalent for ESP32.

For your reference, I am using platformio on vscode.

Is there any way to get lwip napt working with the Arduino framework on ESP32-S3? Any guidance or help would be greatly appreciated.

Thank you in advance for your support.

Sketch

#include "lwip/lwip_napt.h"

#include "lwip/app/dhcpserver.h"
// Initialize the NAT feature
ip_napt_init(IP_NAPT_MAX, IP_PORTMAP_MAX);

// Enable NAT on the AP interface
ip_napt_enable_no(1, 1);

// Set the DNS server for clients of the AP to the one we also use for the STA interface
dhcps_set_DNS(WiFi.dnsIP());

Debug Message

undefined reference to `ip_napt_enable_no'
undefined reference to `ip_napt_enable`

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions