npx skills add smithery/ferhodium --skill memory-analysis
leokemp223/embed-ai-tool
memory-analysis
当需要解析 .map 文件或 ELF 获取固件?
Installation
npx skills add leokemp223/embed-ai-tool --skill memory-analysis
Similar popular skills
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Comprehensive technology-agnostic prompt generator for documenting end-to-end application workf…
9.4K installsExecute `dart analyze` to identify warnings and errors, and use `dart fix --apply` to automatic…
7.6K installsCredit risk data cleaning and variable screening pipeline for pre-loan modeling. Use when worki…
7.4K installsApply statistical methods including descriptive stats, trend analysis, outlier detection, and h…
4K installsCreate professional equity research earnings update reports (8-12 pages, 3,000-5,000 words) ana…
2.9K installsDecompose financial variances into drivers with narrative explanations and waterfall analysis. …
2.8K installsAlso in this package
Other skills from leokemp223/embed-ai-tool · top by installs.
npx skills add leokemp223/embed-ai-tool
More details
Agent compatibility
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
Also listed on
Alternate registries and mirrors of this skill.
Repository health
master
Package contents
Files included with this skill beyond the listing page.
-
skill md
SKILL.md2,813 B -
docs
SUMMARY.md2,776 B
History
- First seen on skills.sh
- First recorded snapshot · 510 installs
SKILL.md
固件内存分析
适用场景
- 构建完成后需要了解固件的 Flash/RAM 使用情况。
- 需要找出占用空间最大的函数或变量。
- 需要对比两次构建的内存变化,追踪代码膨胀。
- 需要确认固件是否即将超出芯片内存限制。
- 需要解析链接脚本获取芯片 Flash/RAM 总容量。
必要输入
.map文件路径(GCC/ARM 链接器生成),或 ELF 文件路径。- 可选的链接脚本路径(用于计算使用率百分比)。
- 可选的告警阈值和 Top-N 符号数量。
自动探测
--scan模式自动搜索构建目录中的.map和 ELF 文件。- 解析
.map文件中的Memory Configuration块获取 FLASH/RAM 总容量。 - 若提供链接脚本,从
MEMORY {}块解析容量信息。 - 自动检测
arm-none-eabi-size和arm-none-eabi-readelf可用性。
执行步骤
- 先阅读 [references/usage.md](references/usage.md),确认本次是环境探测、构建目录扫描,还是执行分析。
- 若不确定工具是否可用,先运行 [scripts/memoryanalyzer.py](scripts/memoryanalyzer.py) 的
--detect模式确认。 - 使用
--scan <build_dir>自动查找可分析的文件。 - 使用
--map-file或--elf执行内存分析。 - 可选使用
--linker-script获取总容量并计算使用率。 - 使用
--top <N>查看占用最大的符号。 - 使用
--compare对比两个.map文件的差异。
失败分流
- 当
arm-none-eabi-size或arm-none-eabi-readelf不可用且需要 ELF 分析时,返回environment-missing。 - 当指定的
.map或 ELF 文件不存在时,返回artifact-missing。 - 当
.map文件格式无法识别或解析失败时,返回project-config-error。 - 当内存使用率超过告警阈值时,在成功结果中附带告警信息。
平台说明
.map文件解析使用纯正则,无需外部工具,全平台可用。- ELF 分析需要
arm-none-eabi-size,通常随交叉编译工具链安装。 - 链接脚本解析使用纯正则,支持 GCC LD 格式。
输出约定
- 输出各 section(.text, .rodata, .data, .bss)的大小和地址。
- 输出 Flash 使用量(.text + .rodata + .data)和 RAM 使用量(.data + .bss)。
- 若有总容量信息,输出使用率百分比和告警状态。
- 输出按大小排序的 Top-N 符号列表。
- 对比模式输出各 section 和符号的增减变化。
交接关系
- 当内存即将溢出需要优化时,建议用户审查 Top-N 大符号。
- 当需要定位具体函数在代码中的位置时,可配合 IDE 或
grep使用。