MicroZed Chronicles: Building PetaLinux for the MiniZed

A few weeks ago I held a webinar on how to develop targeting the Ultra96. The second and third sessions where especially focused on…

Adam Taylor
5 years ago

A few weeks ago I held a webinar on how to develop targeting the Ultra96. The second and third sessions where especially focused on working with Linux.

After the session a number of people emailed me asking if I could do something similar for the MiniZed, especially how to build PetaLinux for a custom PL design.

This is exactly what we are going to do in this blog.

The MiniZed is ideal for IoT and IIoT application prototyping as it provides both WiFi and Bluetooth connectivity.

While we can use the Zynq processor system and programmable logic to implement the application, on the single-core A9 processor within the Zynq we can run a Linux OS to manage the higher levels of the application layer such networking and serving web pages. The programmable logic can be used to accelerate functions, process signals, and images while also providing interfacing to a wide range of sensors and actuators — just what we want in our IoT and IIoT applications.

Of course, before we can begin leveraging the power of the MiniZed we need to know how to build systems that can fuse together the WiFi, Bluetooth, Linux, and functions within the programmable logic.

At this point, I should note that to use the WiFi and Bluetooth the MiniZed design uses interfacing functions within the PL as such we want to ensure we include these elements within our design. Otherwise we will not be able to take full advantage of the devices capabilities.

Ideally, we would have an existing Vivado design with these elements already included and configured to which we can add our design.

This is where the PetaLinux Board Support Package (BSP) comes in. hese are existing PetaLinux projects which include not only known good PetaLinux settings but also the Vivado hardware design.

All we need to do is update the design as necessary in Vivado, and update the PetaLinux project and then generate any Linux applications we desire.

We can obtain our starting point BSP from here.

Once we have the BSP, we need to unzip it downloaded file which will present you with a file named minized.bsp.

However, to access the Vivado hardware project, we also need to unzip the bsp file and also the resulting file. When both of these projects have been unzipped, you will see the following directory strucutre.

It is within this structure you will find the hardware description which contains the current Vivado project.

We can then use Vivado to open the project (in the correct version or above for our download) and then update the design for our application.

Opening the block diagram, you will see several IP blocks for the WiFi, Bluetooth, and to support the LEDs and switches provided.

For this application, we are going to add a simple AXI BRAM controller and BRAM such that we can read and write to and from it. The application is not so important as the process and gaining understanding in this project.

Once we have added these IP blocks, we can then build the updated hardware, and after that is completed, we can export the hardware to SDK.

To build PetaLinux, we need to use a Linux machine, as my main development machine is windows use a virtual machine and a shared drive to transfer files between the two. You can find detailed instructions on creating a VM here.

To install the downloaded BSP on our chosen Linux development system, navigate to where you wish to create the a new PetaLinux project and type the command:

petalinux-create -t project -s minized.bsp

This will import the BSP into PetaLinux and create a new PetaLinux project configured for that BSP. The project will take the name of the BSP.

Once the project has been created, we need to then upload the modified hardware design so that PetaLinux can be regenerated with the correct supporting infrastructure.

To do this, we need to update the hardware description just generated in Vivado as such we need to update the BSP with the new hardware description.

We achieve this using the command:

petalinux-config — get-hw-description=/home/ad/shared

This will open a configuration dialog which enables the project to be configured. We can also configure the kernel, rootfs and u-boot using the command:

petalinux-config -c

Once we are happy with the project configuration, we can then issue the command:

petalinux-build

This will take some time and when complete, you will find an images directory under the MiniZed project containing everything we need.

As you can see in the images directory, there is no boot.bin which is needed in the boot process. However, there are the constituent files such as the bit file, fsbl and u-boot.

To create the boot.bin, we use the petalinux-package command identifying the fsbl, u-boot, and fpga bit files we wish to use to create the boot.bin file as shown below.

By this point we are in position of the necessary files to update on to our Minized. Thankfully we can do this over WiFi. If you are unsure how the take a look at the application note here.

When I ran this up on my MiniZed, I got the following:

Once I had logged in (root/root), I was able to use devmem to test the presence of the BRAM block.

Being able to read and write shows the block RAM memory is indeed present and the hardware was updated correctly.

Now we can create PL designs that we can integrate with the WiFi and Bluetooth capabilities of the MiniZed.

See My FPGA / SoC Projects: Adam Taylor on Hackster.io

Get the Code: ATaylorCEngFIET (Adam Taylor)

Access the MicroZed Chronicles Archives with over 250 articles on the Zynq / Zynq MpSoC updated weekly at MicroZed Chronicles.

Adam Taylor
Adam Taylor is an expert in design and development of embedded systems and FPGA’s for several end applications (Space, Defense, Automotive)
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles