360 Secure SkillHub
360 安全技能中心

Framebuffer Dump

核心功能:通过J-Link读取STM32的SDRAM帧缓冲区原始数据,转换为无相机畸变的PNG图。典型场景:Figma设计稿与设备显示的像素级对比、UI回归测试快照。输入为配置好设备、地址等参数的J-Link命令文件,输出为对应分辨率PNG。工作流程含三步,内置默认参数,附故障排查方案。

ylongw
ylongw
热度 53.35
最近更新 2026-05-11 17:30:03
分类:开发依赖:代码执行 / 读写文件应用场景:调试排错 / 自动化脚本 / 文件转换

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add framebuffer-dump
Metadata
name
framebuffer-dump
description
Dump the current STM32 LCD framebuffer via J-Link and convert it to PNG for visual comparison with Figma. Use when user asks to export, snapshot, dump, or capture what is currently displayed on device screen.

Framebuffer Dump (J-Link → PNG)

Export the actual on-device rendered frame directly from SDRAM framebuffer and convert to PNG.

Default parameters (PRO2)

  • Device: STM32H747XI_M7
  • FB base: 0xD0000000
  • Resolution: 604x1024
  • Pixel format: RGB888 (3 bytes/pixel)
  • Dump size: 604*1024*3 = 1,855,488 (0x1C5000)

One-shot workflow

1) Create J-Link command file

Use scripts/dump_fb.jlink.template and replace placeholders:

  • {{DEVICE}}
  • {{SPEED_KHZ}} (e.g. 12000)
  • {{OUT_BIN}} (absolute path)
  • {{FB_ADDR}} (e.g. 0xD0000000)
  • {{FB_SIZE}} (e.g. 0x1C5000)

2) Dump raw framebuffer

JLinkExe -NoGui 1 -CommandFile /tmp/jlink_dump_fb.jlink > /tmp/jlink_dump_fb.log 2>&1

3) Convert raw to PNG

python3 scripts/dump_fb.py \
  --in /path/to/fb_dump.bin \
  --out /path/to/fb_dump_604x1024.png \
  --width 604 --height 1024 --stride 3

Troubleshooting

  • If output bin is 0 bytes: check J-Link connection / path permissions.
  • If colors look wrong: verify pixel format is RGB888 (not BGR / RGB565).
  • If image shifted/corrupt: verify width/height match current display mode.
  • If command hangs too long: make sure dump size is correct (0x1C5000 for 604x1024 RGB888).

Notes

  • This method captures real framebuffer pixels (no camera distortion).
  • Best for Figma-vs-device pixel comparison and regression snapshots.