Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Modified system-user.dtsi values for pnode and IPI id's for Versal

...

  1. Launch Vitis IDE.

  2. File → New Application Project

  3. Create a new platform from hardware (XSA). Select from the included xsa’s or click on browse and import your xsa to create the platform project.

  4. Specify the application project name; freertos_hello_world_r50 and select psv_cortexr5_0 as the target processor from the list of processors.

    Image RemovedImage Added
  5. Create a new domain for your project. Select freertos10_xilinx as the Operating System from the drop down list.

    Image RemovedImage Added
  6. Select the FreeRTOS hello world template and hit Finish.

  7. Modify the lscript.ld so that the RPU application elf is running out of DDR. This section will also be carved out and reserved for the RPU firmware in the Linux device-tree so that it does not get used by Linux.

  8. Build the application project. The generated elf file in the Debug/Release folder of the application project will be installed in the rootfs of the PetaLinux project.

    Image RemovedImage Added

Build the PetaLinux project

Create a PetaLinux project using the VCK190 BSP (can be downloaded here https://www.xilinx.com/downloadNav/embedded-design-tools/2020-2.html) or your custom xsa. The steps below show how to install the FreeRTOS firmware ELF generated in Vitis described above and install it in the rootfs.

  1. Create a PetaLinux application 

    Code Block
    $ petalinux-create -t apps --template install -n freertos-hello-world-r50 --enable
  2. Replace the default application installed by the template with the freertos_hello_world elf built in Xilinx Vitis for the R5-0 processor into the project-spec/meta-user/recipes-apps/freertos-hello-world-r50/files/ folder.

    Code Block
    cp <vitis-app-proj>/Debug/freertos_hello_world_r50.elf <plnx-proj-root>/project-spec/meta-user/recipes-apps/freertos-hello-world-r50/files/ 
  3. Modify the recipe for the application to include the RPU firmware ELF built in Vitis into the the rootfs.

    Code Block
    $ vim project-spec/meta-user/recipes-apps/freertos-hello-world-r50/freertos-hello-world-r50.bb
    #
    # This file is the freertos-hello-world-r50 recipe.
    #
     
    SUMMARY = "Simple freertos-hello-world-r50 application"
    SECTION = "PETALINUX/apps"
    LICENSE = "MIT"
    LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
     
    SRC_URI = "file://freertos_hello_world_r50.elf"
     
    S = "${WORKDIR}"
    INSANE_SKIP_${PN} = "arch"
     
    do_install() {
             install -d ${D}/lib/firmware
             install -m 0644 ${S}/freertos_hello_world_r50.elf ${D}/lib/firmware/freertos_hello_world_r50.elf
    }
     
    FILES_${PN} = "/lib/firmware/freertos_hello_world_r50.elf"
  4. Copy the contents of the openamp.dtsi from <plnx-proj>/project-spec/meta-user/recipes-bsp/device-tree/files into the system-user.dtsi. Please see the dtsi below for reference. NOTE: the node entry for rproc_0_reserved has the same memory region as the one carved out in the lscript.ld in the Vitis application.

    Code Block
    /include/ "system-conf.dtsi"
    / {
    };
    / {
    	reserved-memory {
    		#address-cells = <2>;
    		#size-cells = <2>;
    		ranges;
    		rpu0vdev0vring0: rpu0vdev0vring0@3ed40000 {
    			no-map;
    			reg = <0x0 0x3ed40000 0x0 0x4000>;
    		};
    		rpu0vdev0vring1: rpu0vdev0vring1@3ed44000 {
    			no-map;
    			reg = <0x0 0x3ed44000 0x0 0x4000>;
    		};
    		rpu0vdev0buffer: rpu0vdev0buffer@3ed48000 {
    			no-map;
    			reg = <0x0 0x3ed48000 0x0 0x100000>;
    		};
    		rproc_0_reserved: rproc@3ed00000 {
    			no-map;
    			reg = <0x0 0x3ed00000 0x0 0x40000>;
    		};
    	};
    
    	zynqmp-rpu {
    		compatible = "xlnx,zynqmp-r5-remoteproc-1.0";
    		#address-cells = <2>;
    		#size-cells = <2>;
    		ranges;
    		core_conf = "split";
    		reg = <0x0 0xFF9A0000 0x0 0x10000>;
    		r5_0: r5@0 {
    			#address-cells = <2>;
    			#size-cells = <2>;
    			ranges;
    			memory-region = <&rproc_0_reserved>, <&rpu0vdev0buffer>, <&rpu0vdev0vring0>, <&rpu0vdev0vring1>;
    			pnode-id = <0x7><0x18110005>;
    			mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>;
    			mbox-names = "tx", "rx";
    			tcm_0_a: tcm_0@0 {
    				reg = <0x0 0xFFE00000 0x0 0x10000>;
    				pnode-id = <0xf><0x1831800b>;
    			};
    			tcm_0_b: tcm_0@1 {
    				reg = <0x0 0xFFE20000 0x0 0x10000>;
    				pnode-id = <0x10><0x1831800c>;
    			};
    		};
    	};
    
    	zynqmp_ipi1 {
    		compatible = "xlnx,zynqmp-ipi-mailbox";
    		interrupt-parent = <&gic>;
    		interrupts = <0 2933 4>;
    		xlnx,ipi-id = <7><5>;
    		#address-cells = <1>;
    		#size-cells = <1>;
    		ranges;
    
    		/* APU<->RPU0 IPI mailbox controller */
    		ipi_mailbox_rpu0: mailbox@ff990600 {
    			reg = <0xff990600<0xff3f0ac0 0x20>,
    			      <0xff990620<0xff3f0ae0 0x20>,
    			      <0xff9900c0<0xff3f0740 0x20>,
    			      <0xff9900e0<0xff3f0760 0x20>;
    			reg-names = "local_request_region",
    				    "local_response_region",
    				    "remote_request_region",
    				    "remote_response_region";
    			#mbox-cells = <1>;
    			xlnx,ipi-id = <1><3>;
    		};
    	};
    };
    
  5. Build the PetaLinux project and package the BOOT.bin

    Code Block
    $ petalinux-build
    $ petalinux-package --boot --plm --psmfw --u-boot --dtb

...