Skip to content

Instantly share code, notes, and snippets.

@pavel-kirienko
Last active March 27, 2025 15:05
Show Gist options
  • Save pavel-kirienko/bd434f741ef2951b5483a1a751284722 to your computer and use it in GitHub Desktop.
Save pavel-kirienko/bd434f741ef2951b5483a1a751284722 to your computer and use it in GitHub Desktop.
Dump SRAM into a file via Black Magic Probe with GDB
#!/bin/sh
ln -fs /dev/serial/by-id/usb-*Black*Magic*-if00 .bmp.tmp
# Replace arm-zephyr-eabi-gdb with the correct toolchain prefix.
# Update the end address depending on the SRAM size.
arm-zephyr-eabi-gdb --batch -ex 'tar ext .bmp.tmp' -ex 'mon swdp_scan' -ex 'attach 1' -ex 'dump bin mem ram.bin 0x20000000 0x20008000'
# To read all Cortex-M4 core peripheral registers:
# mem 0xE000E000 0xE000F000 rw 32 # This is not necessary if "set mem inaccessible-by-default off"
# x/1000xw 0xE000E000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment