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.
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 strucutre 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.