Files
ESP32_COMM/tools/_bss_breakdown.py
T
小龙虾 00b716c8db refactor(debug): 重构调试日志环形缓冲区管理
- 将日志环形缓冲区从静态数组改为动态堆分配
- 实现启动时大容量缓冲区和运行时小容量缓冲区的切换机制
- 添加日志环满时优先保留错误和警告信息的清理策略
- 优化内存使用,在日志为空时避免不必要的内存分配
- 移除调试日志中的冗余字段显示

feat(api): 更新CAN接口为批量发送模式

- 将 `/can/send` 接口替换为 `/can/send_batch`,支持1到N帧的批量发送
- 更新API文档中的接口描述和使用示例
- 修改请求参数格式为 `{"ch":0,"frames":[{...}]}` 返回格式为 `{"status":"ok","results":[...]}`
- 单帧发送也需要通过send_batch接口实现

feat(monitor): 新增GD32 ADC调试反馈处理功能

- 添加gd32_adc_feedback组件用于解析0xC4类型的SPI反馈
- 实现ADC数据解析包括温度、电压等参数的计算和转换
- 在can_feedback_task中集成ADC反馈分发逻辑
- 添加线程安全的数据获取和年龄检查接口

refactor(config): 优化任务栈大小配置并调整OTA块大小

- 重新评估各任务栈使用情况,优化HTTP、WiFi、SPI等工作任务的栈大小
- 将HTTP服务器栈从8KB调整至7KB,WiFi OTA任务栈从4KB调整至3KB
- OTA块大小从2KB调整回4KB以提升传输吞吐性能
- 重新整理配置文件结构,移动WiFi模式配置位置
2026-07-20 03:10:42 +08:00

82 lines
2.3 KiB
Python

#!/usr/bin/env python3
from pathlib import Path
import re
from collections import defaultdict
ROOT = Path(__file__).resolve().parents[1]
text = (ROOT / "build" / "ESP32_COMM.map").read_text(encoding="utf-8", errors="replace")
rows = []
lines = text.splitlines()
i = 0
while i < len(lines):
line = lines[i]
m = re.match(r"^\s*\.bss\.(\S+)\s*$", line)
m2 = re.match(r"^\s*\.bss\.(\S+)\s+(0x[0-9a-fA-F]+)\s+(0x[0-9a-fA-F]+)", line)
if m2:
rows.append((int(m2.group(3), 16), m2.group(1), ""))
elif m:
name = m.group(1)
j = i + 1
while j < len(lines) and j < i + 5:
l2 = lines[j]
mm = re.match(r"^\s+(0x[0-9a-fA-F]+)\s+(0x[0-9a-fA-F]+)\s+(\S+)", l2)
if mm:
rows.append((int(mm.group(2), 16), name, mm.group(3)))
break
if re.match(r"^\s*\.", l2) and not l2.strip().startswith(".bss"):
break
j += 1
i += 1
def demangle(n: str) -> str:
n = n.replace("_ZN12_GLOBAL__N_1L", "")
n = n.replace("_ZL", "")
if n.startswith("_ZZ"):
n = "local:" + n[3:50]
return n[:55]
cats = defaultdict(int)
app = []
for size, name, obj in rows:
o = (obj or "").lower()
if "libmain" in o:
cat = "app(main)"
app.append((size, name, obj))
elif "libfreertos" in o:
cat = "freertos"
elif "liblwip" in o:
cat = "lwip"
elif any(x in o for x in ("libnet80211", "libpp", "libwpa", "libmesh")):
cat = "wifi/mesh"
elif any(x in o for x in ("libnimble", "libbt", "bt.", "ble_")):
cat = "ble"
elif any(
x in name
for x in ("g_cnx", "gWpa", "g_ic", "g_pm", "gChm", "gScan", "g_mesh", "mesh_")
):
cat = "wifi/mesh(sym)"
else:
cat = "other/idf"
cats[cat] += size
print("=== category ===")
for k, v in sorted(cats.items(), key=lambda x: -x[1]):
print(f"{v/1024:6.2f} KB {k}")
print(f"{sum(cats.values())/1024:6.2f} KB TOTAL")
print("\n=== app(main) ===")
app.sort(reverse=True)
s = 0
for size, name, obj in app:
s += size
print(f"{size:5d} {demangle(name)}")
print(f"app sum {s} ({s/1024:.2f} KB)")
print("\n=== top 20 overall ===")
rows.sort(reverse=True)
for size, name, obj in rows[:20]:
short = obj.split("/")[-1] if obj else "?"
print(f"{size:5d} ({size/1024:5.2f}K) {demangle(name):45s} {short[:28]}")