Skip to content

Commit 074402e

Browse files
authored
Merge pull request #4150 from d-a-v/lwip
restore zalloc() + lower lwip2 ram and flash footprint
2 parents 12f336f + de2a382 commit 074402e

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed

tools/sdk/include/mem.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ bool ICACHE_FLASH_ATTR check_memleak_debug_enable(void)
4343
#define os_malloc malloc
4444
#define os_calloc calloc
4545
#define os_realloc realloc
46-
#define os_zalloc zalloc
46+
#define os_zalloc(s) calloc(1,s)
47+
#define zalloc(s) calloc(1,s)
4748

4849
#ifndef MEMLEAK_DEBUG
4950
#define MEMLEAK_DEBUG_ENABLE 0

tools/sdk/lib/liblwip2.a

-4.78 KB
Binary file not shown.

tools/sdk/lib/liblwip2_1460.a

-4.78 KB
Binary file not shown.

tools/sdk/lwip2/README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
```make install```: download, compile, install lwip2
12

2-
make install download, compile, install lwip2
3-
make download download lwIP-2 builder
4-
make clean clean builder only
3+
```make download```: download lwIP-2 builder
4+
5+
```make clean```: clean builder only
56

67
glue and lwIP debug options are in builder/glue/gluedebug.h
8+
79
MSS values are in builder/Makefile.arduino
10+
811
MSS values in boards.txt are only informative
912

1013
current lwip2 submodule repository: https://github.com./d-a-v/esp82xx-nonos-linklayer/tree/arduino-2.4.0

tools/sdk/lwip2/builder

tools/sdk/lwip2/include/gluedebug.h

+16-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// this is needed separately from lwipopts.h
99
// because it is shared by both sides of glue
1010

11+
#define UNDEBUG 1 // 0 or 1 (1: uassert removed)
1112
#define UDEBUG 0 // 0 or 1 (glue debug)
1213
#define UDUMP 0 // 0 or 1 (glue / dump packet)
1314
#define UDEBUGINDEX 0 // 0 or 1 (show debug line number)
@@ -81,8 +82,22 @@ int doprint_minus (const char* format, ...) __attribute__ ((format (printf, 1, 2
8182
#define uprint(x...) do { (void)0; } while (0)
8283
#endif
8384

85+
#if UNDEBUG
86+
#define uassert(assertion...) do { (void)0; } while (0)
87+
#else // !defined(UNDEBUG)
88+
#define uassert(assertion...) \
89+
do { if ((assertion) == 0) { \
90+
static const char assrt[] ICACHE_RODATA_ATTR STORE_ATTR = #assertion " wrong@"; \
91+
os_printf_plus(assrt); \
92+
static const char assrt_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
93+
os_printf_plus(assrt_file); \
94+
static const char assrt_line[] ICACHE_RODATA_ATTR STORE_ATTR = ":%d\n"; \
95+
os_printf_plus(assrt_line, __LINE__); \
96+
uhalt(); \
97+
} } while (0)
98+
#endif // !defined(UNDEBUG)
99+
84100
#define uerror(x...) do { doprint(x); } while (0)
85-
#define uassert(assertion...) do { if ((assertion) == 0) { os_printf_plus("assert fail: " #assertion " @%s:%d\n", __FILE__, __LINE__); uhalt(); } } while (0)
86101
#define uhalt() do { *((int*)0) = 0; /* this triggers gdb */ } while (0)
87102
#define nl() do { uprint("\n"); } while (0)
88103

0 commit comments

Comments
 (0)