We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 

Adam Taylor’s MicroZed Chronicles, Part 171: OpenAMP and PetaLinux Build, Part 2

Xilinx Employee
Xilinx Employee
0 0 47.8K


By Adam Taylor


Having introduced the concept of AMP and the OpenAMP frame work in a previous blog (See Adam Taylor’s MicroZed Chronicles, Part 169: OpenAMP and Asymmetric Processing, Part 1), the easiest way to get OpenAMP up and running is to use one of the examples provided. Once we have the example up and running, we can then add our own application. Getting the example up and running before we develop our own application allows us to pipe-clean the development process.


To create the example, we are going to use PetaLinux SDK to correctly configure the PetaLinux image. We will be running PetaLinux on the Zynq SoC. As such, this blog will also serve as a good tutorial for building and using PetaLinux.


The first thing we need to do is download the PetaLinux SDK and install it on our Linux machine, if you do not have one of these, that’s not a problem. You can use a virtual machine, which is exactly what I am doing. Installing PetaLinx is very simple. You can download the installer from here and the installation guide and all of the supporting documentation is available here.


Once we have installed PetaLinux to get this example going, we are going to follow the UG1186 example and run the “echo world” example. To do this, we need to create a new PetaLinux project and then update it to support Open AMP.


When we create a new PetaLinux project, we need to provide the project a BSP (Board Support Package) reference. We can of course create our own BSP, however as I am going to be using the ZedBoard to demonstrate OpenAMP, I downloaded the ZedBoard BSP provided with the PetaLinux Installation files.


To create the new project, open a terminal window and enter the following:



petalinux-create --type project --name <desired name> -- source <path to BSP>



This command creates the project that we can then customize and build. After you create the project, change your directory to the project directory in the terminal window.


The examples we are going to be using are provided within the PetaLinux project. If you open a File Explorer window, you will find these examples under <project>/components/apps/. We plan to create new code, so this is where will be adding new applications as well.


To run these applications, we need to first make some changes to PetaLinux. The first change is to configure the kernel base address. The bare-metal application and the Linux application need to use different base addresses. The bare-metal application has a fixed base address of 0, so we need to offset the Linux base address. To do this within the terminal window in the project directory type the following command:






This command opens a dialog window that allows us to configure the Linux base address. Using the arrow keys, navigate to Subsytem AUTO Hardware Settings ---> Memory Settings and set the kernel base address to 0x10000000 as shown below. Remember to save the configuration and then navigate from the root menu to U-boot Configuration and set the netboot offset to 0x11000000. Again save the configuration before exiting and returning to the root menu.




Setting the Kernel Base Address






Setting the NetBoot Offset



The next step is to configure the kernel to ensure that it contains the remote processor and can load modules and user firmware. To do this, enter the following command in the terminal window:




petalinux-config -c kernel




This will again open a configuration dialog within which we need to set the following:





Make sure Enable Loadable Module Support is set  







Under Device Drivers --->Generic Drivers ---> set Userspace firmware loading support





Under Device Drivers --->Remoteproc drivers ensure support for the Zynq remoteproc is set



We also need to correctly configure the kernel memory space between user and kernel. Navigate to kernel features ---> Memory split (<current setting> user/kernel split) ---> and set it to 2G/2G:





Setting the User /Kernel Split



The final stage of configuring the kernel is to support high memory support:





Setting the high memory support under Kernel Features



This completes the changes we need to make to the kernel. Save the changes and exit the dialog.


The next thing we need to configure the Root File System to include the example applications. To do this, enter the following to bring up the rootfs dialog:



petalinux-config -c rootfs



Under Apps, ensure that echo_test, mat_mul_demo, and proxy_app are enabled:






Enabling the Apps



We also need to enable the OpenAMP drivers modules. These are under the Modules:




Enabling the OpenAMP drivers



With these changes made, save the changes and exit the dialog. We are nearly now almost ready to create our new PetaLinux build. But first we need to update the device tree to support OpenAMP. To do this, use File Explorer to navigate to:






Within this directory, you will find a number of files including system_top.dts and openamp-overlay.dtsi. Open the system_top.dts file and tell it to include the openamp-overlay.dtsi file by adding the line:



/include/ “openamp-overlay.dtsi”






System_top.dts configured for OpenAMP




Now we are finally ready to build PetaLinux. In the terminal window within the project directory, type:








This will create the following folders within your project directory using the built image files <project>/images/linux.


Within this file you will see a range of files. However, the key files moving forward are:



  • bit – the bit file for the PL
  • elf – the first stage boot loader
  • ub – A combined file which contains the kernel, device tree and rootfs



For this example I want to boot from the SD card so I need to create a boot.bin file. Looking in the directory you will notice one has not been provided. However, all the files we need to create one have been included.


To create a boot.bin file, enter the following using the terminal:



petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/download.bit --uboot



This command creates the boot.bin file that we will put onto our SD card along with the image.ub. Once we have these files on an SD card, connect it to the ZedBoard and boot the board.


Using a serial terminal connected to the ZedBoard, we can now run our example and see that it is running ok. Once the example boots, you need to log in. The username and password are both “root.”


Enter the following command in the terminal to run the example:


modprobe zynq_remoteproc firmware=image_echo_test







Results of running the first command




After the channel is created, you may need to press return to bring up the command prompt again. Now enter the following command:


modprobe rpmsg_user_dev_driver




Result of running the second command



Now it is time to run the application itself. Enter the following:








Start of the Echo Test application



Select option 1 and the test will run to completion. You can exit the application by selecting 2:





Successful test of the example application




At this point, we have successfully demonstrated that OpenAMP is running on the Zynq SoC. (We will look at the Zynq UltraScale+ MPSoC in due course.)


Now we are ready to start developing our own applications using OpenAMP.




Code is available on Github as always.


If you want E book or hardback versions of previous MicroZed chronicle blogs, you can get them below.




  • First Year E Book here
  • First Year Hardback here.



MicroZed Chronicles hardcopy.jpg 




  • Second Year E Book here
  • Second Year Hardback here



 MicroZed Chronicles Second Year.jpg



Tags (2)