Skip to content

Commit e9d3cf4

Browse files
committed
lwip - make lwip thread stack size configurable
Define tcpip-thread-stacksize and default-thread-stacksize in lwip's mbed_lib.json, and use them accordingly in lwipopts.h. Signed-off-by: Tony Wu <[email protected]>
1 parent a514216 commit e9d3cf4

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

features/FEATURE_LWIP/lwip-interface/lwipopts.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,28 @@
8080
#define DEFAULT_RAW_RECVMBOX_SIZE 8
8181
#define DEFAULT_ACCEPTMBOX_SIZE 8
8282

83+
// Thread stack size for lwip tcpip thread
84+
#ifndef MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE
85+
#define MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE 1200
86+
#endif
87+
8388
#ifdef LWIP_DEBUG
84-
#define TCPIP_THREAD_STACKSIZE 1200*2
89+
#define TCPIP_THREAD_STACKSIZE MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2
8590
#else
86-
#define TCPIP_THREAD_STACKSIZE 1200
91+
#define TCPIP_THREAD_STACKSIZE MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE
8792
#endif
8893

8994
#define TCPIP_THREAD_PRIO (osPriorityNormal)
9095

96+
// Thread stack size for lwip system threads
97+
#ifndef MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE
98+
#define MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE 512
99+
#endif
100+
91101
#ifdef LWIP_DEBUG
92-
#define DEFAULT_THREAD_STACKSIZE 512*2
102+
#define DEFAULT_THREAD_STACKSIZE MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2
93103
#else
94-
#define DEFAULT_THREAD_STACKSIZE 512
104+
#define DEFAULT_THREAD_STACKSIZE MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE
95105
#endif
96106

97107
#define MEMP_NUM_SYS_TIMEOUT 16

features/FEATURE_LWIP/lwip-interface/mbed_lib.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232
"udp-socket-max": {
3333
"help": "Maximum number of open UDPSocket instances allowed, including one used internally for DNS. Each requires 84 bytes of pre-allocated RAM",
3434
"value": 4
35+
},
36+
"tcpip-thread-stacksize": {
37+
"help": "Stack size for lwip TCPIP thread",
38+
"value": 1200
39+
},
40+
"default-thread-stacksize": {
41+
"help": "Stack size for lwip system threads",
42+
"value": 512
3543
}
3644
}
3745
}

0 commit comments

Comments
 (0)