
- Installs
- 560
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/leokemp223/embed-ai-tool --skill memory-analysis- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads memory-analysis automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
固件内存分析
适用场景
- 构建完成后需要了解固件的 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,确认本次是环境探测、构建目录扫描,还是执行分析。
- 若不确定工具是否可用,先运行 scripts/memory_analyzer.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使用。
FAQ
What does the memory-analysis skill do?
当需要解析 .map 文件或 ELF 获取固件内存使用报告、符号大小排名或版本对比时使用。
How do I install memory-analysis?
Run npx skills add https://github.com/leokemp223/embed-ai-tool --skill memory-analysis in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/memory-analysis/ (personal) or .claude/skills/memory-analysis/ (project).
Which AI agents can use memory-analysis?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is memory-analysis safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains memory-analysis?
It is published by leokemp223 in leokemp223/embed-ai-tool. It has 560 recorded installs.
More from leokemp223/embed-ai-tool
build-keil
leokemp223/embed-ai-tool
当需要通过 Keil MDK 命令行编译嵌入式工程,调用自带脚本解析工程文件、执行构建并定位固件产物时使用。
build-platformio
leokemp223/embed-ai-tool
当需要通过 PlatformIO 命令行编译嵌入式工程,调用自带脚本解析环境配置、执行构建并定位固件产物时使用。
workflow
leokemp223/embed-ai-tool
当需要串联多个 skill 完成编译+烧录+监控或编译+烧录+调试等流水线任务时使用。
flash-keil
leokemp223/embed-ai-tool
当需要通过 Keil MDK 内置调试器烧录固件到目标板时使用,利用工程中已配置的调试器和 Flash 算法执行下载。
Popular other skills
hyperframes-cli
heygen-com/hyperframes
The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.
triage
mattpocock/skills
Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
ask-matt
mattpocock/skills
Ask which skill or flow fits your situation. A router over the skills in this repo.
to-questionnaire
mattpocock/skills
Turn a decision you can't fully answer into a questionnaire for someone else to fill in.
loop-me
mattpocock/skills
Grill me about specs for the workflows I want to build, within this workspace.