esp-open-lwip
esp-open-lwip copied to clipboard
How to fix the esp-open-lwip's compile-error?
I have already built the esp-open-sdk's toolchain , it looks fine. When compiling the example's blinky, it's ok.
However when I tried to compile this repo esp-open-lwip
,
it occurs some errors as the following..
I don't know much about Makefile. How to fix this error for compiling this repo's esp-open-lwip ?
Thank you very much.
Do the 'make' in the parent directory 'esp-open-skd'. It will decend into the 'esp-open-lwip'.
Thank you very much for the answer.
Now esp-open-lwip
can be compiled well.
Another question, if I would like to compile with loopback too,
How to config this option for esp-open-lwip
?
Thank you.
The support for a loopback device should be included in the default config. See here: https://github.com/martin-ger/esp-open-lwip/blob/enc_polling/include/lwipopts.h#L1217
How to set it up (and process it) - look here: https://github.com/martin-ger/esp_wifi_repeater/blob/master/user/user_main.c for the line with '#if HAVE_LOOPBACK'.
I would like to ping 127.0.0.1 on Arduino by lwip_xxx.a with loopback compiled .
I have just tested by the following code.
#include <ESP8266WiFi.h>
#include "user_interface.h"
#include "ping.h"
#include "lwip/netif.h"
/*****************************
* define & typedef
*****************************/
#define SSID "--------------"
#define PASSWORD "--------------"
typedef enum {
SIG_DO_NOTHING = 0, SIG_START_SERVER = 1, SIG_SEND_DATA, SIG_UART0, SIG_CONSOLE_RX, SIG_CONSOLE_TX, SIG_CONSOLE_TX_RAW, SIG_GPIO_INT, SIG_LOOPBACK
} USER_SIGNALS;
/* System Task, for USER_SIGNALS */
#define user_procTaskPrio 0
#define user_procTaskQueueLen 2
static os_event_t user_procTaskQueue[user_procTaskQueueLen];
/*****************************
* static function prototype
*****************************/
static void user_procTask(os_event_t *events);
static void *schedule_netif_poll(struct netif *netif);
static void esp_ping(IPAddress ip);
/*****************************
* Arduino's setup() & loop()
*****************************/
void setup() {
Serial.begin(115200); Serial.println();
// loopback poll
loopback_netif_init((netif_status_callback_fn)schedule_netif_poll);
system_os_task(user_procTask, user_procTaskPrio, user_procTaskQueue, user_procTaskQueueLen);
WiFi.begin(SSID, PASSWORD);
while (!WiFi.isConnected()) { delay(400); Serial.print("."); }
Serial.println();
Serial.print("STA IP : "); Serial.println(WiFi.localIP());
esp_ping(IPAddress(127, 0, 0, 1));
}
void loop() {
// put your main code here, to run repeatedly:
}
/*****************************
* static functions
*****************************/
static void ICACHE_FLASH_ATTR *schedule_netif_poll(struct netif *netif)
{
system_os_post(0, SIG_LOOPBACK, (ETSParam)netif);
return NULL;
}
//Priority 0 Task
static void ICACHE_FLASH_ATTR user_procTask(os_event_t *events)
{
//os_printf("Sig: %d\r\n", events->sig);
switch (events->sig)
{
case SIG_LOOPBACK:
{
Serial.printf("[%s@LINE_%d] SIG_LOOPBACK\n", __func__ , __LINE__);
struct netif *netif = (struct netif *)events->par;
netif_poll(netif);
}
break;
}
}
static void esp_ping(IPAddress ip) {
static struct ping_option ping_opt;
ping_opt.count = 4;
ping_opt.coarse_time = 1;
ping_opt.ip = ip.v4();
ping_regist_recv(&ping_opt, [](void* arg, void *pdata) {
struct ping_option* ping_opt = (struct ping_option*) arg;
struct ping_resp * ping_res = (struct ping_resp*) pdata;
if (ping_res->ping_err == -1) {
Serial.printf("Reply from %s : offline\n",
IPAddress(ping_opt->ip).toString().c_str() );
} else {
Serial.printf("Reply from %s : bytes = %d time = %d ms\n",
IPAddress(ping_opt->ip).toString().c_str(),
ping_res->bytes, ping_res->resp_time);
}
});
ping_start(&ping_opt);
}
However the result as the following .
What's wrong about the Arduino's loopback code? Do you mind to advise, how to fix this issue?
Thank you.
Hmm, no real idea. Looks fine so far. It probably doesn't change anything if you put the 'netif_poll(netif)' in the loop() function?
Does a ping on the other netifs work?