Read a specific memory address via /dev/mem from the command line

Moritz picture Moritz · Dec 8, 2017 · Viewed 18.4k times · Source

For context, programming a driver to interact with an FPGA IP core on an embedded Linux (Yocto: krogoth) on a Xilinx board.

For debugging purposes I would like to read out specific memory addresses from physical memory. /dev/mem looks promising. I wanted to ask how I can read out the value of a specific physical memory address from the command line. I was hoping for something along the lines of cat /dev/mem 0x2000000 to read the byte at 0x2000000.

Answer

J. In picture J. In · Dec 9, 2017

Usually you should already have devmem tool installed in your Linux image:

$ devmem 0x2000000

If you don't however, you can go to Busybox menu and tweak it to make sure it gets compiled and installed:

$ bitbake busybox -c menuconfig

(search for devmem)