Unverified Commit 919a754e authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Add double-mem LWIP option (#2187)

Add a "-32K" option to all the IP stack options that doubles the PCB and memory
pools from default.  For most use cases this is not necessary, but it could be
helpful in cases where large numbers of TCP clients are connected or high
bandwidth applications.

Fixes #2050
parent 0a2b616c
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -14,6 +14,10 @@ extern void interrupts();
extern unsigned long __lwip_rand(void);
#define LWIP_RAND() __lwip_rand()
#ifndef __LWIP_MEMMULT
#define __LWIP_MEMMULT 1
#endif
// Common settings used in most of the pico_w examples
// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details)
......@@ -22,10 +26,10 @@ extern unsigned long __lwip_rand(void);
#define MEM_LIBC_MALLOC 0
#define MEM_ALIGNMENT 4
#define MEM_SIZE 16384
#define MEMP_NUM_TCP_SEG 32
#define MEMP_NUM_ARP_QUEUE 10
#define PBUF_POOL_SIZE 24
#define MEM_SIZE (__LWIP_MEMMULT * 16384)
#define MEMP_NUM_TCP_SEG (32)
#define MEMP_NUM_ARP_QUEUE (10)
#define PBUF_POOL_SIZE (__LWIP_MEMMULT > 1 ? 32 : 24)
#define LWIP_ARP 2
#define LWIP_ETHERNET 1
#define LWIP_ICMP 1
......@@ -38,11 +42,10 @@ extern unsigned long __lwip_rand(void);
#define LWIP_NETIF_LINK_CALLBACK 1
#define LWIP_NETIF_HOSTNAME 1
#define LWIP_NETCONN 0
#define MEM_STATS 1
#define SYS_STATS 1
#define MEMP_STATS 1
#define MEM_STATS 0
#define SYS_STATS 0
#define MEMP_STATS 0
#define LINK_STATS 0
// #define ETH_PAD_SIZE 2
#define LWIP_CHKSUM_ALGORITHM 0
#define LWIP_DHCP 1
#define LWIP_IPV4 1
......@@ -55,7 +58,8 @@ extern unsigned long __lwip_rand(void);
#define LWIP_DHCP_DOES_ACD_CHECK 0
// See #1285
#define MEMP_NUM_UDP_PCB 6
#define MEMP_NUM_UDP_PCB (__LWIP_MEMMULT * 6)
#define MEMP_NUM_TCP_PCB (__LWIP_MEMMULT * 5)
#if LWIP_IPV6
#define LWIP_IPV6_DHCP6 1
......
No preview for this file type
......@@ -103,6 +103,12 @@ target_compile_definitions(picow-noipv6-nobtc-noble PUBLIC
LWIP_IPV6=0
)
add_library(picow-noipv6-nobtc-noble-big STATIC)
target_compile_definitions(picow-noipv6-nobtc-noble-big PUBLIC
__LWIP_MEMMULT=2
LWIP_IPV6=0
)
set(picow_link_libraries
common
cyw43_driver
......@@ -121,20 +127,40 @@ target_link_libraries(picow-noipv6-nobtc-noble
${picow_link_libraries}
)
target_link_libraries(picow-noipv6-nobtc-noble-big
${picow_link_libraries}
)
add_library(picow-ipv6-nobtc-noble STATIC)
target_compile_definitions(picow-ipv6-nobtc-noble PUBLIC
LWIP_IPV6=1
)
add_library(picow-ipv6-nobtc-noble-big STATIC)
target_compile_definitions(picow-ipv6-nobtc-noble-big PUBLIC
__LWIP_MEMMULT=2
LWIP_IPV6=1
)
target_link_libraries(picow-ipv6-nobtc-noble
${picow_link_libraries}
)
target_link_libraries(picow-ipv6-nobtc-noble-big
${picow_link_libraries}
)
add_library(picow-noipv6-btc-ble STATIC)
target_compile_definitions(picow-noipv6-btc-ble PUBLIC
LWIP_IPV6=0
)
add_library(picow-noipv6-btc-ble-big STATIC)
target_compile_definitions(picow-noipv6-btc-ble-big PUBLIC
__LWIP_MEMMULT=2
LWIP_IPV6=0
)
set(picow_bt_link_libraries
pico_btstack_cyw43
pico_btstack_ble
......@@ -148,17 +174,34 @@ target_link_libraries(picow-noipv6-btc-ble
${picow_bt_link_libraries}
)
target_link_libraries(picow-noipv6-btc-ble-big
${picow_link_libraries}
${picow_bt_link_libraries}
)
add_library(picow-ipv6-btc-ble STATIC)
target_compile_definitions(picow-ipv6-btc-ble PUBLIC
LWIP_IPV6=1
)
add_library(picow-ipv6-btc-ble-big STATIC)
target_compile_definitions(picow-ipv6-btc-ble-big PUBLIC
__LWIP_MEMMULT=2
LWIP_IPV6=1
)
target_link_libraries(picow-ipv6-btc-ble
${picow_link_libraries}
${picow_bt_link_libraries}
)
foreach(tgt pico picow-noipv6-nobtc-noble picow-ipv6-nobtc-noble picow-noipv6-btc-ble picow-ipv6-btc-ble)
target_link_libraries(picow-ipv6-btc-ble-big
${picow_link_libraries}
${picow_bt_link_libraries}
)
foreach(tgt pico picow-noipv6-nobtc-noble picow-ipv6-nobtc-noble picow-noipv6-btc-ble picow-ipv6-btc-ble picow-noipv6-nobtc-noble-big picow-ipv6-nobtc-noble-big picow-noipv6-btc-ble-big picow-ipv6-btc-ble-big)
add_custom_command(TARGET ${tgt} POST_BUILD
COMMAND ar d lib${tgt}.a stdio.c.obj stdio_uart.c.obj stdio_usb.c.obj stdio_usb_descriptors.c.obj pico_malloc.c.obj
COMMAND ar d lib${tgt}.a btstack_flash_bank.c.obj # Need to override with our own implementation
......
......@@ -14,6 +14,10 @@ extern void interrupts();
extern unsigned long __lwip_rand(void);
#define LWIP_RAND() __lwip_rand()
#ifndef __LWIP_MEMMULT
#define __LWIP_MEMMULT 1
#endif
// Common settings used in most of the pico_w examples
// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details)
......@@ -22,10 +26,10 @@ extern unsigned long __lwip_rand(void);
#define MEM_LIBC_MALLOC 0
#define MEM_ALIGNMENT 4
#define MEM_SIZE 16384
#define MEMP_NUM_TCP_SEG 32
#define MEMP_NUM_ARP_QUEUE 10
#define PBUF_POOL_SIZE 24
#define MEM_SIZE (__LWIP_MEMMULT * 16384)
#define MEMP_NUM_TCP_SEG (32)
#define MEMP_NUM_ARP_QUEUE (10)
#define PBUF_POOL_SIZE (__LWIP_MEMMULT > 1 ? 32 : 24)
#define LWIP_ARP 2
#define LWIP_ETHERNET 1
#define LWIP_ICMP 1
......@@ -38,11 +42,10 @@ extern unsigned long __lwip_rand(void);
#define LWIP_NETIF_LINK_CALLBACK 1
#define LWIP_NETIF_HOSTNAME 1
#define LWIP_NETCONN 0
#define MEM_STATS 1
#define SYS_STATS 1
#define MEMP_STATS 1
#define MEM_STATS 0
#define SYS_STATS 0
#define MEMP_STATS 0
#define LINK_STATS 0
// #define ETH_PAD_SIZE 2
#define LWIP_CHKSUM_ALGORITHM 0
#define LWIP_DHCP 1
#define LWIP_IPV4 1
......@@ -55,7 +58,8 @@ extern unsigned long __lwip_rand(void);
#define LWIP_DHCP_DOES_ACD_CHECK 0
// See #1285
#define MEMP_NUM_UDP_PCB 6
#define MEMP_NUM_UDP_PCB (__LWIP_MEMMULT * 6)
#define MEMP_NUM_TCP_PCB (__LWIP_MEMMULT * 5)
#if LWIP_IPV6
#define LWIP_IPV6_DHCP6 1
......
......@@ -117,6 +117,19 @@ def BuildIPBTStack(name):
print("%s.menu.ipbtstack.ipv4ipv6btcble=IPv4 + IPv6 + Bluetooth" % (name))
print('%s.menu.ipbtstack.ipv4ipv6btcble.build.libpicow=libpicow-ipv6-btc-ble.a' % (name))
print('%s.menu.ipbtstack.ipv4ipv6btcble.build.libpicowdefs=-DLWIP_IPV6=1 -DLWIP_IPV4=1 -DENABLE_CLASSIC=1 -DENABLE_BLE=1' % (name))
print("%s.menu.ipbtstack.ipv4onlybig=IPv4 Only - 32K" % (name))
print('%s.menu.ipbtstack.ipv4onlybig.build.libpicow=libpicow-noipv6-nobtc-noble-big.a' % (name))
print('%s.menu.ipbtstack.ipv4onlybig.build.libpicowdefs=-DLWIP_IPV6=0 -DLWIP_IPV4=1 -D__LWIP_MEMMULT=2' % (name))
print("%s.menu.ipbtstack.ipv4ipv6big=IPv4 + IPv6 - 32K" % (name))
print('%s.menu.ipbtstack.ipv4ipv6big.build.libpicow=libpicow-ipv6-nobtc-noble-big.a' % (name))
print('%s.menu.ipbtstack.ipv4ipv6big.build.libpicowdefs=-DLWIP_IPV6=1 -DLWIP_IPV4=1 -D__LWIP_MEMMULT=2' % (name))
print("%s.menu.ipbtstack.ipv4btcblebig=IPv4 + Bluetooth - 32K" % (name))
print('%s.menu.ipbtstack.ipv4btcblebig.build.libpicow=libpicow-noipv6-btc-ble-big.a' % (name))
print('%s.menu.ipbtstack.ipv4btcblebig.build.libpicowdefs=-DLWIP_IPV6=0 -DLWIP_IPV4=1 -DENABLE_CLASSIC=1 -DENABLE_BLE=1 -D__LWIP_MEMMULT=2' % (name))
print("%s.menu.ipbtstack.ipv4ipv6btcblebig=IPv4 + IPv6 + Bluetooth - 32K" % (name))
print('%s.menu.ipbtstack.ipv4ipv6btcblebig.build.libpicow=libpicow-ipv6-btc-ble-big.a' % (name))
print('%s.menu.ipbtstack.ipv4ipv6btcblebig.build.libpicowdefs=-DLWIP_IPV6=1 -DLWIP_IPV4=1 -DENABLE_CLASSIC=1 -DENABLE_BLE=1 -D__LWIP_MEMMULT=2' % (name))
def BuildUploadMethodMenu(name):
for a, b, c, d, e, f in [ ["default", "Default (UF2)", 256, "picoprobe_cmsis_dap.tcl", "uf2conv", "uf2conv-network"],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment