Dump the current STM32 LCD framebuffer via J-Link and convert it to PNG for visual comparison with Figma. Supports RGB888 and RGB565 pixel formats — pick the one matching the target's LTDC configuration (PRO2 currently uses RGB565). Use when user asks to export, snapshot, dump, or capture what is currently displayed on device screen.
Export the actual on-device rendered frame directly from SDRAM framebuffer and convert to PNG.
Pick the format matching the target's LTDC configuration. If you don't know, read LTDC_L1CFBLR pitch (bits 28:16) and divide by width:
| Format | Bytes/px | Dump size (604x1024) |
|---|---|---|
rgb888 | 3 | 0x1C5000 (1,855,488) |
rgb565 | 2 | 0x12E000 (1,236,992) |
STM32H747XI_M70xD0000000604x1024RGB565 (little-endian, LTDC native)604*1024*2 = 1,236,992 (0x12E000)Other targets (e.g. PRO1 or RGB888 builds) use different values — verify by reading the LTDC registers.
Use scripts/dump_fb.jlink.template and replace placeholders:
{{DEVICE}} (e.g. STM32H747XI_M7){{SPEED_KHZ}} (e.g. 12000){{OUT_BIN}} (absolute path){{FB_ADDR}} (e.g. 0xD0000000){{FB_SIZE}} — must match format: 0x12E000 for RGB565, 0x1C5000 for RGB888JLinkExe -NoGui 1 -CommandFile /tmp/jlink_dump_fb.jlink > /tmp/jlink_dump_fb.log 2>&1
# RGB565 (PRO2 default)
python3 scripts/dump_fb.py \
--in /tmp/fb_dump.bin \
--out /tmp/fb_dump.png \
--width 604 --height 1024 --format rgb565
# RGB888
python3 scripts/dump_fb.py \
--in /tmp/fb_dump.bin \
--out /tmp/fb_dump.png \
--width 604 --height 1024 --format rgb888
--format selects bytes-per-pixel and decoder automatically; no need to pass --stride.
Before dumping, you can read the LTDC layer-1 config registers to confirm FB address and pitch:
cat > /tmp/jlink_ltdc.jlink <<'EOF'
device STM32H747XI_M7
si SWD
speed 12000
connect
mem32 0x500010AC 1 # LTDC_L1CFBAR — framebuffer base
mem32 0x500010B0 1 # LTDC_L1CFBLR — pitch (bits 28:16) and line length (bits 12:0)
exit
EOF
JLinkExe -NoGui 1 -CommandFile /tmp/jlink_ltdc.jlink
pitch / width gives bytes/pixel (2 = RGB565, 3 = RGB888).
0xD0000000 is FB_A and 0xD0000000 + 2MB is FB_B; dump both if the front buffer is ambiguous.