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:
@@ -1003,13 +1003,13 @@ void tcp_json_handle_sock_int(uint8_t socketid, uint8_t intstat) {
|
||||
uint16_t space = TCP_JSON_RECV_BUF_LEN - g_json_recv_len;
|
||||
if (recv_len > space) recv_len = space;
|
||||
uint32_t rd_len = recv_len;
|
||||
uint8_t tmp_buf[RECE_BUF_LEN];
|
||||
static uint8_t tmp_buf[RECE_BUF_LEN]; /* 2026-08-17: static — 中断上下文 1KB 栈数组 (防溢出) */
|
||||
WCHNET_SocketRecv(socketid, tmp_buf, &rd_len);
|
||||
g_json_last_comm_ts = mstick(); // 有数据交互
|
||||
memcpy(g_json_recv_buf + g_json_recv_len, tmp_buf, (uint16_t)rd_len);
|
||||
g_json_recv_len += (uint16_t)rd_len;
|
||||
|
||||
char frame[TCP_JSON_MAX_FRAME];
|
||||
static char frame[TCP_JSON_MAX_FRAME]; /* 2026-08-17: static — 中断上下文 800B 栈数组 (防溢出) */
|
||||
while (json_extract_frame(g_json_recv_buf, &g_json_recv_len, frame, sizeof(frame))) {
|
||||
PRINT("JSON recv: %s\n", frame);
|
||||
json_process_frame(socketid, frame);
|
||||
|
||||
Reference in New Issue
Block a user