Search code examples
embedded-linuxyoctoxilinx

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


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.


Solution

  • 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)