By Adam Taylor
We really need an operating system to harness the capabilities of the two or four 64-bit Arm Cortex-A53 processors cores in the Zynq UltraScale+ MPSoC APU (Application Processing Unit). An operating system enables effective APU use by providing SMP (Symmetric Multi-Processing), multitasking, networking, security, memory management, and file system capabilities. Immediate availability of these resources saves us considerable coding and debugging time and allows us to focus on developing the actual application. Putting it succinctly: don’t reinvent the wheel when it comes to operating systems.
Avnet UltraZed-EG SOM plugged into an IOCC (I/O Carrier Card)
PetaLinux is one of the many operating systems that run on the Zynq UltraScale+ MPSoC’s APU. I am going to focus this blog on what we need to do to get PetaLinux up and running on the Zynq UltraScale+ MPSoC using the Avnet UltraZed-EG SoM. However, the process is the same for any design.
To do this we will need:
- A Zynq UltraScale+ MPSoC Design: For this example, I will use the design we created last week
- A Linux machine or Linux Virtual Machine
- PetaLinux and the Xilinx software command-line tool chain installed to configure the PetaLinux OS and perform the build
To ensure that it installs properly, do not use root to install PetaLinux. In other words, do not use the sudo command. If you want to install PetaLinux in the /opt/pkg directory as recommended in the installation guide, you must first change the directory permissions for your user account. Alternatively, you can install PetaLinux in your home area, which is exactly what I did.
With PetaLinux installed, run the settings script in a terminal window (source settings.sh), which sets the environment variable allowing us to call PetaLinux commands.
When we build PetaLinux, we get a complete solution. The build process creates the Linux image, he device tree blob, and a RAM disk combined into a single FIT image. PetaLinux also generates the PMU firmware, the FSBL (First Stage Boot Loader), and U-boot executables needed to create the boot.bin.
We need to perform the following steps to create the FIT image and boot files:
- Export the Vivado hardware definition. This will export the hardware definition file under the directory <project_name.sdk> within the Vivado project
- Create a new PetaLinux project. We are creating a design for a custom board (i.e. there is no PetaLinux BSP), so we will use the command petalinux-create and use the zynqMP template:
petalinux-create –type project –template zynqMP –name part219
- Import the hardware definition from Vivado to configure the PetaLinux project. This will provide not only the bit file and HDF but will be used to create the device trees
- This will open a petalinux configuration menu; you should review the Linux kernel and U-Boot settings. For the basic build in this example we do not need to change anything.
Petalinux configuration page presented once the hardware definition is imported
- If desired you can also review the configuration of constituent parts of u-boot, PMUFW, and Device Tree or RAMFS by using the command:
Petalinux-config -c <u-boot or PMUFW or device-tree or rootfs>
- Build the PetaLinux kernel using the command:
This might take some time.
- Create the boot.bin file.
petalinux-package –boot –fsbl zynqmp_fsbl.elf –u-boot u-boot.elf –pmufw pmufw.elf –fpga fpga.bit
Once we have created the image file and the bin file, we can copy them to a SD card and boot the UltraZed-EG SOM.
Just as we simulate our logic designs first, we can test the PetaLinux image within our Linux build environment using QEMU. This allows us to verify that the image we have created will load correctly.
We run QEMU by issuing the following command:
petalinux-boot –qemu –image < Linux-image-file>
Created Petalinux image running in QEMU
Once we can see the PetaLinux image booting correctly in QEMU, the next step is to try it on the UltraZed-EG SOM. Copy the image.ub and boot.bin files to an SD card, configure the UltraZed-EG SOM mounted on the IOCC (I/O Carrier Card) to boot from the SD card, insert the SD card, and apply power.
If everything has been done correctly, you should see the FSBL load the PMU firmware in the terminal window. Then, U-Boot should run and load the Linux kernel.
Linux running on the UltraZed-EG SOM
Once the boot process has completed, we can log in using the user name and password of root, and then begin using our PetaLinux environment.
Now that we have the Zynq UltraScale+ MPSoC’s APU up and running with PetaLinux, we can use OpenAMP to download and execute programs in the Zynq UltraScale+ MPSoC’s dual-core ARM Cortex-R5 RPU (Real-time Processing Unit). We will explore how we do this in another blog.
Meanwhile, the following links were helpful in the generation of this image:
The project, as always, is on GitHub.
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.
Second Year E Book here
Second Year Hardback here
via Xcell Daily Blog articles http://ift.tt/2fBJIws
October 10, 2017 at 02:15AM