I have noticed, that there are plenty of people, who do not know how to access the physical memory from linux (or for myself at least from Xilinx’s petalinux). Basically, a bare-metal application running on a CPU has direct access to memory by default, but advanced Operating Systems such as linux create a virtual address page for each process (Application) so that there is no direct connection between the memory seen inside the application and the real Physical memory of the device. To overcome this issue, the memory has to be mapped via mmap64:

Note that accessing the memory with this way is not as efficient as running custom kernel drives. Also bear in mind that HW devices (such as DMA) still need to use the the physical address rather than virtual. Setting the DMA’s destination or source address as the virtual memory is a common source of errors. The ZYNQ ultrascale+ TRM (Chap. 10) provides also a memory map showing the physical bases of the RAM,which is divided into UPPER and LOWER segment. The lower segment disposes only 2GB of memory, so that if the device has more than 2GB, the rest is accessible via the upper segment:

In case there is an FPGA peripheral in the logic, which is accessible through the  M_AXI_HPM0_LPD ZynqMP port, the Vivado address editor provides (or the designer shall manually provide) the address, under which the peripheral is accessible. The range is limited by the port range (in this case 0x8000_000 to 0xA000_0000). An example showing a custom APB peripheral on address 0x8003_0000 with range 64KB and a DMA_IP core at address 0x8002_0000 with range of 4KB is shown below:


Share This