From 66a96410d4336c312de32b1cf5db954aab9ee2ec Mon Sep 17 00:00:00 2001 From: Deomid Ryabkov <rojer@cesanta.com> Date: Thu, 16 Feb 2017 19:00:55 +0800 Subject: [PATCH] ESP8266: Add RTOS SDK port (MGOS_ESP8266_RTOS=1) PUBLISHED_FROM=ca5332e63700274ed9aeea9d9d1802e89fa788fa --- examples/ESP8266_RTOS/Makefile | 2 ++ examples/ESP8266_RTOS/build.sh | 2 +- examples/ESP8266_RTOS/sdk.version | 2 +- examples/ESP8266_RTOS/user/user_main.c | 4 ++++ mongoose.c | 6 +++--- mongoose.h | 5 +++++ 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/examples/ESP8266_RTOS/Makefile b/examples/ESP8266_RTOS/Makefile index 05752a442..704768696 100644 --- a/examples/ESP8266_RTOS/Makefile +++ b/examples/ESP8266_RTOS/Makefile @@ -116,3 +116,5 @@ sinclude $(SDK_PATH)/Makefile .PHONY: FORCE FORCE: +clean: + rm -rf user/.output .bin diff --git a/examples/ESP8266_RTOS/build.sh b/examples/ESP8266_RTOS/build.sh index 9bcd891c7..7f2ec05c4 100755 --- a/examples/ESP8266_RTOS/build.sh +++ b/examples/ESP8266_RTOS/build.sh @@ -3,7 +3,7 @@ docker run \ --rm -i -v $(realpath ${PWD}/../..):/src \ --entrypoint=/bin/bash $(cat sdk.version) -l -c -x ' - export SDK_PATH=/opt/Espressif/ESP8266_SDK; + export SDK_PATH=/opt/Espressif/ESP8266_RTOS_SDK; export BIN_PATH=./bin; cd /src/examples/ESP8266_RTOS && mkdir -p ./bin && make clean && diff --git a/examples/ESP8266_RTOS/sdk.version b/examples/ESP8266_RTOS/sdk.version index 960f7975d..6a66e9d93 100644 --- a/examples/ESP8266_RTOS/sdk.version +++ b/examples/ESP8266_RTOS/sdk.version @@ -1 +1 @@ -docker.cesanta.com/esp8266-build-rtos:1.4.0-r2 +docker.cesanta.com/esp8266-build:2.0.0-1.5.0-r1 diff --git a/examples/ESP8266_RTOS/user/user_main.c b/examples/ESP8266_RTOS/user/user_main.c index c8abb1041..60cf8728c 100644 --- a/examples/ESP8266_RTOS/user/user_main.c +++ b/examples/ESP8266_RTOS/user/user_main.c @@ -107,3 +107,7 @@ void user_init(void) { xTaskCreate(mg_task, (const signed char *) "mongoose", MG_TASK_STACK_SIZE, NULL, MGOS_TASK_PRIORITY, &s_mg_task_handle); } + +uint32_t user_rf_cal_sector_set(void) { + return 0xfb; /* 0xfb000, just before system data for 8Mbit flash. */ +} diff --git a/mongoose.c b/mongoose.c index 46365a6dc..959fb5f9c 100644 --- a/mongoose.c +++ b/mongoose.c @@ -13801,7 +13801,7 @@ void mg_lwip_set_keepalive_params(struct mg_connection *nc, int idle, static err_t mg_lwip_tcp_conn_cb(void *arg, struct tcp_pcb *tpcb, err_t err) { struct mg_connection *nc = (struct mg_connection *) arg; - DBG(("%p connect to %s:%u = %d", nc, IPADDR_NTOA(&tpcb->remote_ip), + DBG(("%p connect to %s:%u = %d", nc, IPADDR_NTOA(ipX_2_ip(&tpcb->remote_ip)), tpcb->remote_port, err)); if (nc == NULL) { tcp_abort(tpcb); @@ -14042,8 +14042,8 @@ void mg_lwip_accept_conn(struct mg_connection *nc, struct tcp_pcb *tpcb) { static err_t mg_lwip_accept_cb(void *arg, struct tcp_pcb *newtpcb, err_t err) { struct mg_connection *lc = (struct mg_connection *) arg; (void) err; - DBG(("%p conn %p from %s:%u", lc, newtpcb, IPADDR_NTOA(&newtpcb->remote_ip), - newtpcb->remote_port)); + DBG(("%p conn %p from %s:%u", lc, newtpcb, + IPADDR_NTOA(ipX_2_ip(&newtpcb->remote_ip)), newtpcb->remote_port)); struct mg_connection *nc = mg_if_accept_new_conn(lc); if (nc == NULL) { tcp_abort(newtpcb); diff --git a/mongoose.h b/mongoose.h index 79dd21434..1ec11e512 100644 --- a/mongoose.h +++ b/mongoose.h @@ -1615,6 +1615,11 @@ void mg_lwip_set_keepalive_params(struct mg_connection *nc, int idle, int interval, int count); #endif +/* For older version of LWIP */ +#ifndef ipX_2_ip +#define ipX_2_ip(x) (x) +#endif + #endif /* MG_LWIP */ #endif /* CS_COMMON_PLATFORMS_LWIP_MG_LWIP_H_ */ -- GitLab