cancel
Showing results for 
Search instead for 
Did you mean: 

AXI CDMA Linux user space example on Zynq UltraScale+ RFSoC

Xilinx Employee
Xilinx Employee
5 3 1,124

This blog entry will show you how to create an AXI CDMA Linux userspace example application.

The example design will transfer data from the PS DDR to the AXI BRAM through the AXI CDMA on a Zynq UltraScale+ RFSoC ZCU111 Evaluation Kit.

Applicable Platforms

 

Vivado and PetaLinux 2019.2.

Zynq UltraScale+ RFSoC ZCU111 Evaluation Kit.

Boot Mode: JTAG, SD

Block Diagram

 

image2020-3-8_9-58-25.png

image2020-3-8_9-59-14.png

Vivado Steps

 

Step 1: Create a project targeting a ZCU111 board and block design per the above block design.

Step 2: Configure the AXI CDMA with the below settings:

image2020-3-8_10-6-28.png

Step 3: Select Validate design to validate and check the address editor once it has completed successfully.

Step 4: Create a top file BD and generate the bitstream.

Step 5: Export the hardware design to get the XSA file.

PetaLinux Steps

 

The following steps are used to generate the boot image and Linux user-space application.

Step 1:

Create an AXI CDMA user space application using the below command with the attached content (axicdma.c).

vim axicdma.c

Step 2:

petalinux-create -t project -n bram--template zynqMP

Step 3:

petalinux-config --v --get-hw-description=<hdf directory>

Step 4:

Add the following changes in the system-user.dtsi file to disable the CDMA driver and reserve memory.

           /include/ "system-conf.dtsi"
           / {
           #address-cells = <2>;
           #size-cells = <2>;
           memory {
           device_type = "memory";
           reg = <0x0 0x0 0x0 0x80000000>, <0x0 0xA0000000 0x0 0x40000>, <0x00000008 0x00000000 0x0 0x80000000>;
           };
           reserved-memory {
           ranges;
           reserved {
           reg = <0x0 0xa0000000 0x0 0x40000>;
           };
           };

           };
           &axi_bram_ctrl_1 {
           status = "disabled";
           };

           &axi_cdma_0 {
           status = "disabled";
           };

 

Step 5:

petalinux-config -c kernel

Then select the following:

           Kernel hacking  --->[ ] Filter access to /dev/mem  --> Save & exit 

 

Step 6:

petalinux-build

Step 7:

petalinux-package --boot --fsbl images/linux/zynqmp_fsbl.elf --pmufw images/linux/pmufw.elf --fpga images/linux/system.bit  --u-boot  images/linux/u-boot.elf --force

Step 8: 

Copy the BOOT.bin and image.ub files to the SD card along with the test application binary.

Step 9:

Boot the board and run the attached application (axicmda.c).

Run Design

 

To run the design, first connect to the ZCU111 board and boot the images from the SD card, then run the binary application.

Console Output

 

/dev/mem opened.
BRAM Memory mapped at address 0x7fb5339000.
PSDDR Memory mapped at address 0x7fb5192000.
CDMA Memory mapped at address 0x7fb5336000.
Input : value in PSDDR 0 : value in BRAM 1179403647
Input : value in PSDDR 1 : value in BRAM 65794
Input : value in PSDDR 2 : value in BRAM 0
Input : value in PSDDR 3 : value in BRAM 0
Input : value in PSDDR 4 : value in BRAM 11993091
Input : value in PSDDR 5 : value in BRAM 1
Input : value in PSDDR 6 : value in BRAM 13128
Input : value in PSDDR 7 : value in BRAM 0
Input : value in PSDDR 8 : value in BRAM 64
Input : value in PSDDR 9 : value in BRAM 0
Input : value in PSDDR 10 : value in BRAM 44872
Input : value in PSDDR 11 : value in BRAM 0
Input : value in PSDDR 12 : value in BRAM 0
Input : value in PSDDR 13 : value in BRAM 3670080
Input : value in PSDDR 14 : value in BRAM 4194313
Input : value in PSDDR 15 : value in BRAM 1638426
Input : value in PSDDR 16 : value in BRAM 6
Input : value in PSDDR 17 : value in BRAM 4
Input : value in PSDDR 18 : value in BRAM 64
Input : value in PSDDR 19 : value in BRAM 0
Input : value in PSDDR 20 : value in BRAM 64
Input : value in PSDDR 21 : value in BRAM 0
Input : value in PSDDR 22 : value in BRAM 64
Input : value in PSDDR 23 : value in BRAM 0
Input : value in PSDDR 24 : value in BRAM 504
Input : value in PSDDR 25 : value in BRAM 0
Input : value in PSDDR 26 : value in BRAM 504
Input : value in PSDDR 27 : value in BRAM 0
Input : value in PSDDR 28 : value in BRAM 8
Input : value in PSDDR 29 : value in BRAM 0
Input : value in PSDDR 30 : value in BRAM 3
Input : value in PSDDR 31 : value in BRAM 4
Input : value in PSDDR 32 : value in BRAM 568
Input : value in PSDDR 33 : value in BRAM 0
Input : value in PSDDR 34 : value in BRAM 568
Input : value in PSDDR 35 : value in BRAM 0
Input : value in PSDDR 36 : value in BRAM 568
Input : value in PSDDR 37 : value in BRAM 0
Input : value in PSDDR 38 : value in BRAM 27
Input : value in PSDDR 39 : value in BRAM 0
Input : value in PSDDR 40 : value in BRAM 27
Input : value in PSDDR 41 : value in BRAM 0
Input : value in PSDDR 42 : value in BRAM 1
Input : value in PSDDR 43 : value in BRAM 0
Input : value in PSDDR 44 : value in BRAM 1
Input : value in PSDDR 45 : value in BRAM 5
Input : value in PSDDR 46 : value in BRAM 0
Input : value in PSDDR 47 : value in BRAM 0
Input : value in PSDDR 48 : value in BRAM 0
Input : value in PSDDR 49 : value in BRAM 0
Input : value in PSDDR 50 : value in BRAM 0
Input : value in PSDDR 51 : value in BRAM 0
Input : value in PSDDR 52 : value in BRAM 37116
Input : value in PSDDR 53 : value in BRAM 0
Input : value in PSDDR 54 : value in BRAM 37116
Input : value in PSDDR 55 : value in BRAM 0
Input : value in PSDDR 56 : value in BRAM 65536
Input : value in PSDDR 57 : value in BRAM 0
Input : value in PSDDR 58 : value in BRAM 1
Input : value in PSDDR 59 : value in BRAM 6
Input : value in PSDDR 60 : value in BRAM 39544
Input : value in PSDDR 61 : value in BRAM 0
Input : value in PSDDR 62 : value in BRAM 105080
Input : value in PSDDR 63 : value in BRAM 0
Input : value in PSDDR 64 : value in BRAM 105080
Input : value in PSDDR 65 : value in BRAM 0
Input : value in PSDDR 66 : value in BRAM 5072
Input : value in PSDDR 67 : value in BRAM 0
Input : value in PSDDR 68 : value in BRAM 6168
Input : value in PSDDR 69 : value in BRAM 0
Input : value in PSDDR 70 : value in BRAM 65536
Input : value in PSDDR 71 : value in BRAM 0
Input : value in PSDDR 72 : value in BRAM 2
Input : value in PSDDR 73 : value in BRAM 6
Input : value in PSDDR 74 : value in BRAM 39560
Input : value in PSDDR 75 : value in BRAM 0
Input : value in PSDDR 76 : value in BRAM 105096
Input : value in PSDDR 77 : value in BRAM 0
Input : value in PSDDR 78 : value in BRAM 105096
Input : value in PSDDR 79 : value in BRAM 0
Input : value in PSDDR 80 : value in BRAM 512
Input : value in PSDDR 81 : value in BRAM 0
Input : value in PSDDR 82 : value in BRAM 512
Input : value in PSDDR 83 : value in BRAM 0
Input : value in PSDDR 84 : value in BRAM 8
Input : value in PSDDR 85 : value in BRAM 0
Input : value in PSDDR 86 : value in BRAM 4
Input : value in PSDDR 87 : value in BRAM 4
Input : value in PSDDR 88 : value in BRAM 596
Input : value in PSDDR 89 : value in BRAM 0
Input : value in PSDDR 90 : value in BRAM 596
Input : value in PSDDR 91 : value in BRAM 0
Input : value in PSDDR 92 : value in BRAM 596
Input : value in PSDDR 93 : value in BRAM 0
Input : value in PSDDR 94 : value in BRAM 68
Input : value in PSDDR 95 : value in BRAM 0
Input : value in PSDDR 96 : value in BRAM 68
Input : value in PSDDR 97 : value in BRAM 0
Input : value in PSDDR 98 : value in BRAM 4
Input : value in PSDDR 99 : value in BRAM 0
control reg:0x00000000
status reg:0x00000002
all interrupts masked...
control reg:0x00005000
status reg:0x00000002
Writing source address
Source addr reg:0x04000000
status reg:0x00000002
Writing destination address
Dest addr reg:0xa0000000
status reg:0x00000002
Writing transfer length...
DMA transfer is completed
length reg:0x00000190
status reg:0x00001002
Output : value in PSDDR 0 : value in BRAM 0
Output : value in PSDDR 1 : value in BRAM 1
Output : value in PSDDR 2 : value in BRAM 2
Output : value in PSDDR 3 : value in BRAM 3
Output : value in PSDDR 4 : value in BRAM 4
Output : value in PSDDR 5 : value in BRAM 5
Output : value in PSDDR 6 : value in BRAM 6
Output : value in PSDDR 7 : value in BRAM 7
Output : value in PSDDR 8 : value in BRAM 8
Output : value in PSDDR 9 : value in BRAM 9
Output : value in PSDDR 10 : value in BRAM 10
Output : value in PSDDR 11 : value in BRAM 11
Output : value in PSDDR 12 : value in BRAM 12
Output : value in PSDDR 13 : value in BRAM 13
Output : value in PSDDR 14 : value in BRAM 14
Output : value in PSDDR 15 : value in BRAM 15
Output : value in PSDDR 16 : value in BRAM 16
Output : value in PSDDR 17 : value in BRAM 17
Output : value in PSDDR 18 : value in BRAM 18
Output : value in PSDDR 19 : value in BRAM 19
Output : value in PSDDR 20 : value in BRAM 20
Output : value in PSDDR 21 : value in BRAM 21
Output : value in PSDDR 22 : value in BRAM 22
Output : value in PSDDR 23 : value in BRAM 23
Output : value in PSDDR 24 : value in BRAM 24
Output : value in PSDDR 25 : value in BRAM 25
Output : value in PSDDR 26 : value in BRAM 26
Output : value in PSDDR 27 : value in BRAM 27
Output : value in PSDDR 28 : value in BRAM 28
Output : value in PSDDR 29 : value in BRAM 29
Output : value in PSDDR 30 : value in BRAM 30
Output : value in PSDDR 31 : value in BRAM 31
Output : value in PSDDR 32 : value in BRAM 32
Output : value in PSDDR 33 : value in BRAM 33
Output : value in PSDDR 34 : value in BRAM 34
Output : value in PSDDR 35 : value in BRAM 35
Output : value in PSDDR 36 : value in BRAM 36
Output : value in PSDDR 37 : value in BRAM 37
Output : value in PSDDR 38 : value in BRAM 38
Output : value in PSDDR 39 : value in BRAM 39
Output : value in PSDDR 40 : value in BRAM 40
Output : value in PSDDR 41 : value in BRAM 41
Output : value in PSDDR 42 : value in BRAM 42
Output : value in PSDDR 43 : value in BRAM 43
Output : value in PSDDR 44 : value in BRAM 44
Output : value in PSDDR 45 : value in BRAM 45
Output : value in PSDDR 46 : value in BRAM 46
Output : value in PSDDR 47 : value in BRAM 47
Output : value in PSDDR 48 : value in BRAM 48
Output : value in PSDDR 49 : value in BRAM 49
Output : value in PSDDR 50 : value in BRAM 50
Output : value in PSDDR 51 : value in BRAM 51
Output : value in PSDDR 52 : value in BRAM 52
Output : value in PSDDR 53 : value in BRAM 53
Output : value in PSDDR 54 : value in BRAM 54
Output : value in PSDDR 55 : value in BRAM 55
Output : value in PSDDR 56 : value in BRAM 56
Output : value in PSDDR 57 : value in BRAM 57
Output : value in PSDDR 58 : value in BRAM 58
Output : value in PSDDR 59 : value in BRAM 59
Output : value in PSDDR 60 : value in BRAM 60
Output : value in PSDDR 61 : value in BRAM 61
Output : value in PSDDR 62 : value in BRAM 62
Output : value in PSDDR 63 : value in BRAM 63
Output : value in PSDDR 64 : value in BRAM 64
Output : value in PSDDR 65 : value in BRAM 65
Output : value in PSDDR 66 : value in BRAM 66
Output : value in PSDDR 67 : value in BRAM 67
Output : value in PSDDR 68 : value in BRAM 68
Output : value in PSDDR 69 : value in BRAM 69
Output : value in PSDDR 70 : value in BRAM 70
Output : value in PSDDR 71 : value in BRAM 71
Output : value in PSDDR 72 : value in BRAM 72
Output : value in PSDDR 73 : value in BRAM 73
Output : value in PSDDR 74 : value in BRAM 74
Output : value in PSDDR 75 : value in BRAM 75
Output : value in PSDDR 76 : value in BRAM 76
Output : value in PSDDR 77 : value in BRAM 77
Output : value in PSDDR 78 : value in BRAM 78
Output : value in PSDDR 79 : value in BRAM 79
Output : value in PSDDR 80 : value in BRAM 80
Output : value in PSDDR 81 : value in BRAM 81
Output : value in PSDDR 82 : value in BRAM 82
Output : value in PSDDR 83 : value in BRAM 83
Output : value in PSDDR 84 : value in BRAM 84
Output : value in PSDDR 85 : value in BRAM 85
Output : value in PSDDR 86 : value in BRAM 86
Output : value in PSDDR 87 : value in BRAM 87
Output : value in PSDDR 88 : value in BRAM 88
Output : value in PSDDR 89 : value in BRAM 89
Output : value in PSDDR 90 : value in BRAM 90
Output : value in PSDDR 91 : value in BRAM 91
Output : value in PSDDR 92 : value in BRAM 92
Output : value in PSDDR 93 : value in BRAM 93
Output : value in PSDDR 94 : value in BRAM 94
Output : value in PSDDR 95 : value in BRAM 95
Output : value in PSDDR 96 : value in BRAM 96
Output : value in PSDDR 97 : value in BRAM 97
Output : value in PSDDR 98 : value in BRAM 98
Output : value in PSDDR 99 : value in BRAM 99
Transmitted Data successfully
root@cdma_proj:~#

Sceen Capture of the Output

 

image2020-3-8_11-54-25.png

References:

 

https://www.xilinx.com/support/documentation/ip_documentation/axi_cdma/v4_1/pg034-axi-cdma.pdf

https://www.xilinx.com/support/documentation/sw_manuals/xilinx2019_2/ug1144-petalinux-tools-reference-guide.pdf

3 Comments
Visitor
Visitor

Thx for the tutorial. I think you had a copy paste issue: 

Step 1:

Create an AXI CDMA user space application using the below command with the attached content (axicdma.c).

vim axicmda.c

i think with this command no user space application will be created

Regard 

Max 

Voyager
Voyager

@abommera,

Thanks for the tutorial.

Just one question: why you are not using the UIO driver ?

This way you don't need to know CDMA's S_AXI_LITE base address.

s.

Xilinx Employee
Xilinx Employee

Hi @simozz ,

The intension of this tutorial is to easily understand the Linux user-space application with the DMA engine.

Thanks & Regards,

Anil