perf(vd960DBN): 二轮RAM瘦身 — RECE_BUF_LEN 1024 + ARP 16 + 中断路径static (2026-08-17)

.map 分析: BLE 栈固定占 RAM 低 16KB 不可裁; 用户 48KB 内 .bss 41.7KB。
- net_config.h: RECE_BUF_LEN MSS×2(1400)→1024 (MSS=700帧+头≈740B, 5数组省~2.6KB)
- net_config.h: WCHNET_NUM_ARP_TABLE 50→16 (停车场景IP少, 省~0.8KB)
- tcp_json_srv.c: tmp_buf[RECE_BUF_LEN]/frame[800] 局部→static (中断上下文栈数组防溢出)

栈 4.7KB→~6.3KB, 中断栈峰值 -1.8KB。devlog 记录 .map 分析结论。
This commit is contained in:
wangfq
2026-08-17 14:26:22 +08:00
parent 89ba602e4f
commit cb63c581be
3 changed files with 25 additions and 10 deletions
@@ -90,7 +90,10 @@ extern "C" {
/* If you want to achieve a higher transmission speed,
* try to increase RECE_BUF_LEN to (WCHNET_TCP_MSS*4)
* and increase WCHNET_NUM_TCP_SEG to (WCHNET_NUM_TCP*4)*/
#define RECE_BUF_LEN (WCHNET_TCP_MSS*2) /* socket receive buffer size */
/* 2026-08-17 RAM 瘦身: MSS×2(1400)→1024 — MSS=700 时完整 TCP 段+头≈740B,
1024 足够; 5 个 RECE_BUF_LEN 数组 (SocketRecvBuf/MyBuf/tmp/_iot_wchnet_buf/
g_json_wchnet_buf) 合计省 ~2.6KB .bss (栈空间 +2.6KB) */
#define RECE_BUF_LEN 1024 /* socket receive buffer size */
#define WCHNET_NUM_PBUF WCHNET_NUM_POOL_BUF /* Number of PBUF structures */
@@ -98,7 +101,7 @@ extern "C" {
#define WCHNET_MEM_HEAP_SIZE (((WCHNET_TCP_MSS+0x10+54+8)*WCHNET_NUM_TCP_SEG)+ETH_TX_BUF_SZE+64+2*0x18) /* memory heap size */
#define WCHNET_NUM_ARP_TABLE 50 /* Number of ARP lists */
#define WCHNET_NUM_ARP_TABLE 16 /* 2026-08-17: 50→16 (停车设备同时连接 IP 少, 省 ~0.8KB .bss) */
#define WCHNET_MEM_ALIGNMENT 4 /* 4 byte alignment */