For many applications in this blog and my Hackster projects, I use a bare metal approach.
However, sometimes we need the capabilities provided by a operating system, e.g. networking, working with higher level languages and frameworks, file management, etc.
I recently had to create an PetaLinux for the Cora board, and as it one of the smaller Z7010 devices, I thought it would make a good compliment to the Building PetaLinux for the MiniZed blog — especially as there is no pre-existing PetaLinux BSP for the Cora.
The first thing we need is a Vivado design. For this example, I want to be able to use the Pmods, the RGB LEDs ,and the push buttons. As such, my Vivado design includes the following IP:
AXI GPIO — Configured as an output for RGB LEDs.
AXI GPIO — Configured as an input for the push button switches.
IOP MicroBlaze Processors — These are connected to the Pmod A and B and come from the Pynq Z2 base design.
Once we have the design implemented, the next stage is to build the Vivado hardware and export the Hardware Definition File (HDF).
It is this file we will use to to customize the PetaLinux build.
To create the Petalinx OS, I used a virtual machine onto which I have installed PetaLinux 2018.2
Now this is where our development is different to previous examples. In those examples, we had a PetaLinux board support package (BSP) to work with; however in this example, there is no Cora BSP so we have to start from scratch.
The first thing we need to do in PetaLinux is to create a project. We can do this using the command:
$petalinux-create — type project — template zynq — name cora
This creates a project which will can be targeted at a Zynq 7000 series device. Of course, we need to be able to customize it for our hardware design.
To do this, we import the HDF and apply it to the project using the command:
$petalinux-config — get-hw-description=
Once this has been imported, you will see a PetaLinux configuration box appear. Here is where we would make any changes we desire. For this example, though, we will not change anything. If prompted to save the new configuration as you exit, select yes.
Once you exit the configuration menu, bitbake will run and generate all of the files we need. Please note that this might take several minutes.
Once this is completed, we can build the project using:
Again this will take a few minutes.
Once this is built, we have all of the constituent parts required to run Petalinux. The final stage is to create the Boot.BIN which contains the first stage boot loader (FSBL) and the programmable logic configuration.
To do this, we need to change directory into the /images/linux directory and run the command: