Skip to content

Commit

Permalink
Readjusting the esp-open-lwip patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
slav-at-attachix committed Nov 22, 2017
1 parent 04e11b6 commit 23d4c43
Showing 1 changed file with 82 additions and 71 deletions.
153 changes: 82 additions & 71 deletions Sming/third-party/.patches/esp-open-lwip.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
diff --git a/include/user_config.h b/include/user_config.h
index e69de29..235ceff 100644
--- a/include/user_config.h
+++ b/include/user_config.h
@@ -0,0 +1,20 @@
+#ifndef _USER_CONFIG_LWIP_
+#define _USER_CONFIG_LWIP_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef signed short sint16_t;
+
+void ets_bzero(void *block, size_t size);
+bool ets_post(uint32_t prio, ETSSignal sig, ETSParam par);
+void ets_task(ETSTask task, uint32_t prio, ETSEvent * queue, uint8 qlen);
+
+void system_pp_recycle_rx_pkt(void *eb);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_USER_CONFIG_LWIP_*/
diff --git a/Makefile.open b/Makefile.open
index 1bc584f..e4af916 100644
--- a/Makefile.open
Expand Down Expand Up @@ -50,38 +75,44 @@ index 1bc584f..e4af916 100644
$(LIB): $(OBJS)
$(AR) rcs $@ $^
diff --git a/include/arch/cc.h b/include/arch/cc.h
index ff03b30..e86ae57 100644
index ff03b30..0da8ed3 100644
--- a/include/arch/cc.h
+++ b/include/arch/cc.h
@@ -34,12 +34,18 @@
#ifndef __ARCH_CC_H__
#define __ARCH_CC_H__

-//#include <string.h>
@@ -38,8 +38,25 @@
#include "c_types.h"
#include "ets_sys.h"
#include "osapi.h"
+#include "mem.h"
+#include <stdarg.h>
+
#define EFAULT 14

+//Extra symbols to avoid implicit declaration warnings
+extern void *ets_memset(void *s, int c, size_t n);
+extern void *ets_memcpy(void *dest, const void *src, size_t n);
+
+extern int ets_strlen(const char *s);
+extern int os_printf_plus(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
+extern int ets_sprintf(char *str, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
+//extern void ets_timer_arm_new(ETSTimer *ptimer, uint32_t milliseconds, bool repeat_flag, int isMstimer);
+extern void ets_timer_disarm(ETSTimer *a);
+extern void ets_timer_setfn(ETSTimer *t, ETSTimerFunc *pfunction, void *parg);
+extern uint32 r_rand(void);
+extern int ets_memcmp(const void *s1, const void *s2, size_t n);
+
+struct netif * eagle_lwip_getif(uint8 index);
+
//#define LWIP_PROVIDE_ERRNO

#if (1)
@@ -56,6 +62,7 @@ typedef signed short s16_t;
@@ -56,6 +73,7 @@ typedef signed short s16_t;
typedef unsigned long u32_t;
typedef signed long s32_t;
typedef unsigned long mem_ptr_t;
+typedef signed short sint16_t;

#define S16_F "d"
#define U16_F "d"
@@ -73,11 +80,12 @@ typedef unsigned long mem_ptr_t;
@@ -73,11 +91,12 @@ typedef unsigned long mem_ptr_t;
#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_END

Expand All @@ -98,48 +129,6 @@ index ff03b30..e86ae57 100644
#else
#define LWIP_PLATFORM_DIAG(x)
#define LWIP_PLATFORM_ASSERT(x)
diff --git a/include/lwip/ip_addr.h b/include/lwip/ip_addr.h
index 1e46ee5..cfc10f8 100644
--- a/include/lwip/ip_addr.h
+++ b/include/lwip/ip_addr.h
@@ -210,7 +210,7 @@ u8_t ip4_addr_netmask_valid(u32_t netmask)ICACHE_FLASH_ATTR;
#define ip_addr_islinklocal(addr1) (((addr1)->addr & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xa9fe0000UL))

#define ip_addr_debug_print(debug, ipaddr) \
- LWIP_DEBUGF(debug, ("%"U16_F".%"U16_F".%"U16_F".%"U16_F, \
+ LWIP_DEBUGF(debug, ("%" U16_F ".%" U16_F ".%" U16_F ".%" U16_F, \
ipaddr != NULL ? ip4_addr1_16(ipaddr) : 0, \
ipaddr != NULL ? ip4_addr2_16(ipaddr) : 0, \
ipaddr != NULL ? ip4_addr3_16(ipaddr) : 0, \
diff --git a/include/lwip/mem.h b/include/lwip/mem.h
index af6e360..6d8cabd 100644
--- a/include/lwip/mem.h
+++ b/include/lwip/mem.h
@@ -52,19 +52,19 @@ typedef size_t mem_size_t;
*/
#ifndef MEMLEAK_DEBUG
#ifndef mem_free
-#define mem_free vPortFree
+#define mem_free(s) vPortFree(s, "", 0)
#endif
#ifndef mem_malloc
-#define mem_malloc pvPortMalloc
+#define mem_malloc(s) pvPortMalloc(s, "", 0)
#endif
#ifndef mem_calloc
-#define mem_calloc pvPortCalloc
+#define mem_calloc(s) pvPortCalloc(s, "", 0);
#endif
#ifndef mem_realloc
-#define mem_realloc pvPortRealloc
+#define mem_realloc(p, s) pvPortRealloc(p, s, "", 0)
#endif
#ifndef mem_zalloc
-#define mem_zalloc pvPortZalloc
+#define mem_zalloc(s) pvPortZalloc(s, "", 0)
#endif
#else
#ifndef mem_free
diff --git a/include/lwipopts.h b/include/lwipopts.h
index eaa8dd6..6568657 100644
--- a/include/lwipopts.h
Expand Down Expand Up @@ -216,26 +205,48 @@ index eaa8dd6..6568657 100644
#endif

/**
diff --git a/include/user_config.h b/include/user_config.h
index e69de29..07768eb 100644
--- a/include/user_config.h
+++ b/include/user_config.h
@@ -0,0 +1,15 @@
+#ifndef _USER_CONFIG_LWIP_
+#define _USER_CONFIG_LWIP_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "c_types.h"
+void system_pp_recycle_rx_pkt(void *eb);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_USER_CONFIG_LWIP_*/
diff --git a/include/lwip/ip_addr.h b/include/lwip/ip_addr.h
index 1e46ee5..cfc10f8 100644
--- a/include/lwip/ip_addr.h
+++ b/include/lwip/ip_addr.h
@@ -210,7 +210,7 @@ u8_t ip4_addr_netmask_valid(u32_t netmask)ICACHE_FLASH_ATTR;
#define ip_addr_islinklocal(addr1) (((addr1)->addr & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xa9fe0000UL))

#define ip_addr_debug_print(debug, ipaddr) \
- LWIP_DEBUGF(debug, ("%"U16_F".%"U16_F".%"U16_F".%"U16_F, \
+ LWIP_DEBUGF(debug, ("%" U16_F ".%" U16_F ".%" U16_F ".%" U16_F, \
ipaddr != NULL ? ip4_addr1_16(ipaddr) : 0, \
ipaddr != NULL ? ip4_addr2_16(ipaddr) : 0, \
ipaddr != NULL ? ip4_addr3_16(ipaddr) : 0, \
diff --git a/include/lwip/mem.h b/include/lwip/mem.h
index af6e360..6d8cabd 100644
--- a/include/lwip/mem.h
+++ b/include/lwip/mem.h
@@ -52,19 +52,19 @@ typedef size_t mem_size_t;
*/
#ifndef MEMLEAK_DEBUG
#ifndef mem_free
-#define mem_free vPortFree
+#define mem_free(s) vPortFree(s, "", 0)
#endif
#ifndef mem_malloc
-#define mem_malloc pvPortMalloc
+#define mem_malloc(s) pvPortMalloc(s, "", 0)
#endif
#ifndef mem_calloc
-#define mem_calloc pvPortCalloc
+#define mem_calloc(s) pvPortCalloc(s, "", 0);
#endif
#ifndef mem_realloc
-#define mem_realloc pvPortRealloc
+#define mem_realloc(p, s) pvPortRealloc(p, s, "", 0)
#endif
#ifndef mem_zalloc
-#define mem_zalloc pvPortZalloc
+#define mem_zalloc(s) pvPortZalloc(s, "", 0)
#endif
#else
#ifndef mem_free
diff --git a/lwip/app/dhcpserver.c b/lwip/app/dhcpserver.c
index ddb5984..fb677c6 100644
--- a/lwip/app/dhcpserver.c
Expand Down

0 comments on commit 23d4c43

Please sign in to comment.