[F2H AXI] - FPGA accessing HPS RAM - FPGA WR | HPS RD

Hi!

I am building a monitoring system which acquires data from many inputs in the FPGA side and writes all the data in the HPS SDRAM (I am using DE-0 Nano-SoC) through the f2h_axi_slave port by conecting a mSGDMA on it. I have configured the mSGDMA descriptor and I have a streaming interface sending data to the DMA and the DMA writes it onto the SDRAM.

I have some doubts about these following items below. If you can help me I will be grateful.

  • I have decreased the Linux usage of the memory to 512MB, but how can I get the exact address range that Linux uses? (thus I won’t try to write at it with the FPGA).
  • How should I read the data? Just by using mmap?
  • There is a way I can output memory data from a specific address through bash (I’ve seen some memtool program doing this)?

Thanks!

I have decreased the Linux usage of the memory to 512MB, but how can I get the exact address range that Linux uses? (thus I won’t try to write at it with the FPGA).

How did you reserve the memory? If you simply told Linux to use a reduced amount of memory through the command line then it’ll use the lower portion of the RAM.

How should I read the data? Just by using mmap?

You can mmap /dev/mem to access the data.

A “cleaner” solution would be to write a linux driver that would allocate the memory, handle the remapping and provide a nice, safe interface for the userland. You’ll also probably want a kernel driver if you need to deal with interrupts. But if you want to do everything from userland then /dev/mem will be your friend.

There is a way I can output memory data from a specific address through bash (I’ve seen some memtool program doing this)?

I use devmem for that purpose. It’s available in busybox or as a standalone program. It simply remaps /dev/mem to access physical memory.

2 Likes

I have reserved the memory by setting up a new u-boot adding this line of code and then compiling it. The system tells me it has 512MB (by running free -m).
" setenv mmcboot 'setenv bootargs console=ttyS0,115200 mem=512M root=${mmcroot} rw rootwait;bootz "

Thanks for the clarification! Devmem works well :grinning:

Right, then as far as I know that means that linux will use the low 512MB of RAM and will completely ignore anything beyond that.

2 Likes