diff --git a/examples/ESP8266_RTOS/Makefile b/examples/ESP8266_RTOS/Makefile
index 05752a442c3fec313156d6cb819636d10f03749d..704768696d04e3ea861faa3878110bc470ae8d10 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 9bcd891c78f1f64875168ec9133ad293a66205a1..7f2ec05c408678918a7d45f27b71dcee5b2dae7b 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 960f7975dbdee30c37577fdd0997c204ac42d2ef..6a66e9d937f08a5360852b8ccfa8f164bf275c84 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 c8abb104154b9f9df5a26dd33ee352ce6abfa7cd..60cf8728c0a618e681bd58928b5bd93ac3f55eda 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 46365a6dcbd60381b6f88e402b05d88dff7e544b..959fb5f9c8c8c8cc19ef3f5a076bce15d4bae759 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 79dd21434179ce9bda8d84788c141302d92ce5e3..1ec11e5126bfee9e44cac6aabb8353e878620697 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_ */