[libretiny] Set BK72XX PBUF_POOL_SIZE to 10 to match default plan

PBUF_POOL_SIZE=4 was the minimum to pass lwIP's sanity check but caused
pbuf exhaustion during concurrent connections (API + web_server + OTA),
resulting in dropped log messages.

Set to 10 to match the BK SDK default plan and ESP8266. RTL/LN already
default to 20 and need no override.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
J. Nick Koston
2026-02-21 14:58:11 -06:00
parent 2b00a809c8
commit 18c89a1cce

View File

@@ -292,6 +292,7 @@ def _configure_lwip(config: dict) -> None:
TCP_SND_BUF 2×MSS 4×MSS 10×MSS 5×MSS 7×MSS 4×MSS
TCP_WND 4×MSS 4×MSS 10×MSS 2×MSS 3×MSS 4×MSS
MEM_SIZE 1.6KB N/A* 32KB 5KB N/A* 5KB BK
PBUF_POOL_SIZE 10 16 3/10 20 20 10 BK
MAX_SOCKETS_TCP 5 16 12 —** —** dynamic
MAX_SOCKETS_UDP 4 16 22 —** —** dynamic
TCP_SND_QUEUELEN ~8 17 20 20 35 17
@@ -373,11 +374,11 @@ def _configure_lwip(config: dict) -> None:
# LN882H uses MEM_LIBC_MALLOC=1 (system heap), so MEM_SIZE is irrelevant.
if CORE.is_bk72xx:
lwip_opts.append("MEM_SIZE=5120") # BK SDK: 32,768, RTL SDK: 5,120
# PBUF_POOL_SIZE: BK SDK "reduced plan" sets this to only 3, which is
# too small for TCP_WND=4×MSS (5840 > 3*1526=4578). Set to 4 so the
# lwIP sanity check passes: 4*1526=6104 > 5840.
# RTL(20) and LN(20) are already large enough.
lwip_opts.append("PBUF_POOL_SIZE=4")
# PBUF_POOL_SIZE: BK SDK "reduced plan" sets this to only 3 — too few
# for multiple concurrent connections (API + web_server + OTA).
# BK default plan uses 10; match that. RTL(20) and LN(20) need no override.
# Cost: 10 × 1580 = 15.8KB static RAM (vs 3 × 1580 = 4.7KB before).
lwip_opts.append("PBUF_POOL_SIZE=10")
cg.add_platformio_option("custom_options.lwip", lwip_opts)