Showing results for 
Show  only  | Search instead for 
Did you mean: 

AXI DMA Linux user space application on Zynq MPSoC platform

0 0 257

This Blog entry is intended to illustrate an AXI DMA Linux user space example which sends data to the AXI Stream Data FIFO from the PS DDR and writes data on the PS DDR which is received from the AXI Stream Data FIFO.

The example design is created in the 2020.2 version of Vivado® and targets a ZCU106 evaluation board. The Tcl script for this design and application code are available in the attachments to this blog entry.

The design files (Tcl script, DMA user space application and ILA waveform) are attached at the end of this blog.


Block Diagram:



Functional Description:

In the design the AXI DMA is connected to the PS DDR for memory mapped transactions and the AXI Stream data FIFO is connected for Stream transactions. The user space application reads the data from the source address in the PS DDR and writes it to the AXI Stream data FIFO on the MM2S channel.

The data which is written into the stream data FIFO is received back on the S2MM port of the AXI DMA and the DMA writes this data back to the destination address of the PS DDR.

Design steps:

Step 1: Download the attachment and source the zynqmp_axidma_bd.tcl file in Vivado.

Step 2: Create the HDL wrapper and then run synthesis, implementation and generate the bitstream.

Step 3: Export hardware with the bitstream and get the XSA file.

Step 4: source the XSA file in PetaLinux and build it.


Adding a Custom Application in PetaLinux:

Step 1: To create a user space dmatest.c, run the below command from inside a PetaLinux project

$ petalinux-create -t apps --template c --name dmatest –enable

The new application sources can be found in the <project_path>/project-spec/meta-user/recipes-apps/dmatest directory.

Step 2: replace the dmatest.c file with the file downloaded from attachments.

The dmatest.c file can be found in the <project_path>/project-spec/meta-user/recipes-apps/dmatest/files/ directory.

Step 3: add the line: RM_WORK_EXCLUDE += "dmatest" to the <project_path>/project-spec/meta-user/conf/petalinuxbsp.conf file

This will build artifacts for debugging with the third-party utilities.

Step 4: build the user application

$ petalinux-build -c dmatest

Step 5: build the rootfs

$ petalinux-build -c rootfs


Run the design

Copy the images onto SD card and boot the device in SD boot mode.

Console Output:


ILA waveform: