360 Secure SkillHub
360 安全技能中心

Framebuffer Dump

该 Skill 通过 J-Link 从 STM32 设备 SDRAM 帧缓冲导出原始像素数据,再调用 Python 脚本按指定宽高和步长转换为 PNG。默认适配 604x1024 RGB888 显示,主要用于与 Figma 设计稿做像素对比或回归快照,并提供连接、颜色格式和尺寸问题的排查提示;但引用的 J-Link 命令模板文件缺失。

分类:开发
ylongw
ylongw
热度 39.45
最近更新 2026-05-11 17:30:03

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add ylongw/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.