From 0fd1201633322b1f8ddcccd92f0fea53e3cfd525 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Mon, 21 Dec 2015 14:47:48 +0200 Subject: [PATCH 1/7] fix tcp status redefinition and bad mem definitions in lwip --- .../ESP8266WiFi/src/include/wl_definitions.h | 16 ---------------- libraries/ESP8266WiFi/src/lwip/mem.h | 10 +++++----- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/libraries/ESP8266WiFi/src/include/wl_definitions.h b/libraries/ESP8266WiFi/src/include/wl_definitions.h index 45bee6764..0669661b3 100644 --- a/libraries/ESP8266WiFi/src/include/wl_definitions.h +++ b/libraries/ESP8266WiFi/src/include/wl_definitions.h @@ -68,20 +68,4 @@ enum wl_enc_type { /* Values map to 802.11 encryption suites... */ ENC_TYPE_AUTO = 8 }; -#if !defined(LWIP_INTERNAL) -enum wl_tcp_state { - CLOSED = 0, - LISTEN = 1, - SYN_SENT = 2, - SYN_RCVD = 3, - ESTABLISHED = 4, - FIN_WAIT_1 = 5, - FIN_WAIT_2 = 6, - CLOSE_WAIT = 7, - CLOSING = 8, - LAST_ACK = 9, - TIME_WAIT = 10 -}; -#endif - #endif /* WL_DEFINITIONS_H_ */ diff --git a/libraries/ESP8266WiFi/src/lwip/mem.h b/libraries/ESP8266WiFi/src/lwip/mem.h index 1d768856c..ed58aa47f 100644 --- a/libraries/ESP8266WiFi/src/lwip/mem.h +++ b/libraries/ESP8266WiFi/src/lwip/mem.h @@ -51,19 +51,19 @@ typedef size_t mem_size_t; * allow these defines to be overridden. */ #ifndef mem_free -#define mem_free(p) vPortFree(p, "", 0) +#define mem_free(p) vPortFree(p) #endif #ifndef mem_malloc -#define mem_malloc(s) pvPortMalloc(s, "", 0) +#define mem_malloc(s) pvPortMalloc(s) #endif #ifndef mem_calloc -#define mem_calloc(s) pvPortCalloc(s, "", 0) +#define mem_calloc(s) pvPortCalloc(s) #endif #ifndef mem_realloc -#define mem_realloc(p, s) pvPortRealloc(p, s, "", 0) +#define mem_realloc(p, s) pvPortRealloc(p, s) #endif #ifndef mem_zalloc -#define mem_zalloc(s) pvPortZalloc(s, "", 0) +#define mem_zalloc(s) pvPortZalloc(s) #endif #ifndef os_malloc From bcfdfb6b67f92c72b26352ee6821bba90b25ac93 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Mon, 21 Dec 2015 14:52:56 +0200 Subject: [PATCH 2/7] more bad definitions interesting that they differ in issues with 1.3 over the same source did pvPort* change in between? --- libraries/ESP8266WiFi/src/lwip/mem.h | 10 +++++----- libraries/ESP8266WiFi/src/lwip/mem_manager.h | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libraries/ESP8266WiFi/src/lwip/mem.h b/libraries/ESP8266WiFi/src/lwip/mem.h index ed58aa47f..1d768856c 100644 --- a/libraries/ESP8266WiFi/src/lwip/mem.h +++ b/libraries/ESP8266WiFi/src/lwip/mem.h @@ -51,19 +51,19 @@ typedef size_t mem_size_t; * allow these defines to be overridden. */ #ifndef mem_free -#define mem_free(p) vPortFree(p) +#define mem_free(p) vPortFree(p, "", 0) #endif #ifndef mem_malloc -#define mem_malloc(s) pvPortMalloc(s) +#define mem_malloc(s) pvPortMalloc(s, "", 0) #endif #ifndef mem_calloc -#define mem_calloc(s) pvPortCalloc(s) +#define mem_calloc(s) pvPortCalloc(s, "", 0) #endif #ifndef mem_realloc -#define mem_realloc(p, s) pvPortRealloc(p, s) +#define mem_realloc(p, s) pvPortRealloc(p, s, "", 0) #endif #ifndef mem_zalloc -#define mem_zalloc(s) pvPortZalloc(s) +#define mem_zalloc(s) pvPortZalloc(s, "", 0) #endif #ifndef os_malloc diff --git a/libraries/ESP8266WiFi/src/lwip/mem_manager.h b/libraries/ESP8266WiFi/src/lwip/mem_manager.h index 035596891..58c2a02ae 100644 --- a/libraries/ESP8266WiFi/src/lwip/mem_manager.h +++ b/libraries/ESP8266WiFi/src/lwip/mem_manager.h @@ -3,7 +3,7 @@ #include "c_types.h" -/*------------------------±äÁ¿¶¨Òå------------------------*/ +/*------------------------��������------------------------*/ #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE #ifndef IOT_SIP_MODE @@ -61,7 +61,7 @@ static const unsigned short heapSTRUCT_SIZE = ( sizeof( xBlockLink ) + portBYTE_ //static size_t xFreeBytesRemaining = ( ( size_t ) configADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK ); -/*------------------------º¯ÊýÉùÃ÷-----------------------------------*/ +/*------------------------��������-----------------------------------*/ //static void prvInsertBlockIntoFreeList( xBlockLink *pxBlockToInsert ) ;//ICACHE_FLASH_ATTR; @@ -69,9 +69,9 @@ static const unsigned short heapSTRUCT_SIZE = ( sizeof( xBlockLink ) + portBYTE_ void vApplicationMallocFailedHook( void ) ;//ICACHE_FLASH_ATTR; -void *pvPortMalloc( size_t xWantedSize ) ;//ICACHE_FLASH_ATTR; +//void *pvPortMalloc( size_t xWantedSize ) ;//ICACHE_FLASH_ATTR; -void vPortFree( void *pv ) ;//ICACHE_FLASH_ATTR; +//void vPortFree( void *pv ) ;//ICACHE_FLASH_ATTR; size_t xPortGetFreeHeapSize( void ) ;//ICACHE_FLASH_ATTR; From f553467f64762650ddab63dc6ecd27d7f4866fd8 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Tue, 22 Dec 2015 01:06:32 +0200 Subject: [PATCH 3/7] add aligned wraps for pvPortMalloc and pvPortRealloc --- cores/esp8266/libc_replacements.c | 10 ++++++++++ platform.txt | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cores/esp8266/libc_replacements.c b/cores/esp8266/libc_replacements.c index f7d1420e3..948bc7e03 100644 --- a/cores/esp8266/libc_replacements.c +++ b/cores/esp8266/libc_replacements.c @@ -39,6 +39,16 @@ #include "user_interface.h" #include "debug.h" +extern void *__real_pvPortMalloc(size_t xWantedSize, const char* file, int line); +extern void *__wrap_pvPortMalloc(size_t xWantedSize, const char* file, int line){ + return __real_pvPortMalloc(((xWantedSize + 3) & ~((size_t)0x3)), file, line); +} + +extern void *__real_pvPortRealloc(void* ptr, size_t xWantedSize, const char* file, int line); +extern void *__wrap_pvPortRealloc(void* ptr, size_t xWantedSize, const char* file, int line){ + return __real_pvPortRealloc(ptr, ((xWantedSize + 3) & ~((size_t)0x3)), file, line); +} + void* ICACHE_RAM_ATTR malloc(size_t size) { size = ((size + 3) & ~((size_t)0x3)); return os_malloc(size); diff --git a/platform.txt b/platform.txt index efeb816e9..1ffbf2818 100644 --- a/platform.txt +++ b/platform.txt @@ -27,7 +27,7 @@ compiler.c.flags=-c {compiler.warning_flags} -Os -g -Wpointer-arith -Wno-implici compiler.S.cmd=xtensa-lx106-elf-gcc compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls -compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,register_chipv6_phy +compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,register_chipv6_phy -Wl,-wrap,pvPortMalloc -Wl,-wrap,pvPortRealloc compiler.c.elf.cmd=xtensa-lx106-elf-gcc compiler.c.elf.libs=-lm -lgcc -lhal -lphy -lpp -lnet80211 -llwip -lwpa -lcrypto -lmain -lwps -laxtls -lsmartconfig -lmesh From 7e8e535d3f0341a656dd5f58bcd3e04bc06ad7c4 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Tue, 22 Dec 2015 12:51:28 +0200 Subject: [PATCH 4/7] revert some changes and fix wl_definitions --- cores/esp8266/libc_replacements.c | 10 ---------- .../ESP8266WiFi/src/include/wl_definitions.h | 18 ++++++++++++++++++ platform.txt | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/cores/esp8266/libc_replacements.c b/cores/esp8266/libc_replacements.c index 948bc7e03..f7d1420e3 100644 --- a/cores/esp8266/libc_replacements.c +++ b/cores/esp8266/libc_replacements.c @@ -39,16 +39,6 @@ #include "user_interface.h" #include "debug.h" -extern void *__real_pvPortMalloc(size_t xWantedSize, const char* file, int line); -extern void *__wrap_pvPortMalloc(size_t xWantedSize, const char* file, int line){ - return __real_pvPortMalloc(((xWantedSize + 3) & ~((size_t)0x3)), file, line); -} - -extern void *__real_pvPortRealloc(void* ptr, size_t xWantedSize, const char* file, int line); -extern void *__wrap_pvPortRealloc(void* ptr, size_t xWantedSize, const char* file, int line){ - return __real_pvPortRealloc(ptr, ((xWantedSize + 3) & ~((size_t)0x3)), file, line); -} - void* ICACHE_RAM_ATTR malloc(size_t size) { size = ((size + 3) & ~((size_t)0x3)); return os_malloc(size); diff --git a/libraries/ESP8266WiFi/src/include/wl_definitions.h b/libraries/ESP8266WiFi/src/include/wl_definitions.h index 0669661b3..f6e86754f 100644 --- a/libraries/ESP8266WiFi/src/include/wl_definitions.h +++ b/libraries/ESP8266WiFi/src/include/wl_definitions.h @@ -68,4 +68,22 @@ enum wl_enc_type { /* Values map to 802.11 encryption suites... */ ENC_TYPE_AUTO = 8 }; +#ifndef __LWIP_TCP_H__ +#ifndef LWIP_INTERNAL +enum wl_tcp_state { + CLOSED = 0, + LISTEN = 1, + SYN_SENT = 2, + SYN_RCVD = 3, + ESTABLISHED = 4, + FIN_WAIT_1 = 5, + FIN_WAIT_2 = 6, + CLOSE_WAIT = 7, + CLOSING = 8, + LAST_ACK = 9, + TIME_WAIT = 10 +}; +#endif +#endif + #endif /* WL_DEFINITIONS_H_ */ diff --git a/platform.txt b/platform.txt index 1ffbf2818..efeb816e9 100644 --- a/platform.txt +++ b/platform.txt @@ -27,7 +27,7 @@ compiler.c.flags=-c {compiler.warning_flags} -Os -g -Wpointer-arith -Wno-implici compiler.S.cmd=xtensa-lx106-elf-gcc compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls -compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,register_chipv6_phy -Wl,-wrap,pvPortMalloc -Wl,-wrap,pvPortRealloc +compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,register_chipv6_phy compiler.c.elf.cmd=xtensa-lx106-elf-gcc compiler.c.elf.libs=-lm -lgcc -lhal -lphy -lpp -lnet80211 -llwip -lwpa -lcrypto -lmain -lwps -laxtls -lsmartconfig -lmesh From f0f9114f7057e8476ab99d4a5eb4016250bb9c7a Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Tue, 22 Dec 2015 13:31:06 +0200 Subject: [PATCH 5/7] fix extra endif --- libraries/ESP8266WiFi/src/include/wl_definitions.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/ESP8266WiFi/src/include/wl_definitions.h b/libraries/ESP8266WiFi/src/include/wl_definitions.h index ba4ffa16a..5c8c53660 100644 --- a/libraries/ESP8266WiFi/src/include/wl_definitions.h +++ b/libraries/ESP8266WiFi/src/include/wl_definitions.h @@ -83,6 +83,5 @@ enum wl_tcp_state { TIME_WAIT = 10 }; #endif -#endif #endif /* WL_DEFINITIONS_H_ */ From 1d2237bc9d81f1eca420dff04c27385201d3f8a0 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Sat, 9 Jan 2016 00:12:36 +0200 Subject: [PATCH 6/7] fix pwm first step getting skipped --- cores/esp8266/core_esp8266_wiring_pwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/esp8266/core_esp8266_wiring_pwm.c b/cores/esp8266/core_esp8266_wiring_pwm.c index 9d16b62b7..8d97895ff 100644 --- a/cores/esp8266/core_esp8266_wiring_pwm.c +++ b/cores/esp8266/core_esp8266_wiring_pwm.c @@ -103,7 +103,7 @@ void ICACHE_RAM_ATTR pwm_timer_isr(){ current_step = 0; stepcount = 0; if(pwm_mask == 0) return; - T1L = (pwm_steps[current_step+1] * pwm_multiplier); + T1L = (pwm_steps[current_step] * pwm_multiplier); TEIE |= TEIE1; if(pwm_mask & 0xFFFF) GPOS = pwm_mask & 0xFFFF; if(pwm_mask & 0x10000) GP16O = 1; From cccff08a37d5be95b46b165707a05adae8057b31 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Sat, 9 Jan 2016 00:15:13 +0200 Subject: [PATCH 7/7] revert change, though signatures are wrong --- libraries/ESP8266WiFi/src/lwip/mem_manager.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/ESP8266WiFi/src/lwip/mem_manager.h b/libraries/ESP8266WiFi/src/lwip/mem_manager.h index 58c2a02ae..cb237f4f8 100644 --- a/libraries/ESP8266WiFi/src/lwip/mem_manager.h +++ b/libraries/ESP8266WiFi/src/lwip/mem_manager.h @@ -69,9 +69,9 @@ static const unsigned short heapSTRUCT_SIZE = ( sizeof( xBlockLink ) + portBYTE_ void vApplicationMallocFailedHook( void ) ;//ICACHE_FLASH_ATTR; -//void *pvPortMalloc( size_t xWantedSize ) ;//ICACHE_FLASH_ATTR; +void *pvPortMalloc( size_t xWantedSize ) ;//ICACHE_FLASH_ATTR; -//void vPortFree( void *pv ) ;//ICACHE_FLASH_ATTR; +void vPortFree( void *pv ) ;//ICACHE_FLASH_ATTR; size_t xPortGetFreeHeapSize( void ) ;//ICACHE_FLASH_ATTR;