#2 Software-->from Vivado to Vitis to Petalinux
Table of Contents
1 Diversity software toolsets
Zybo Z7 is hardware platform
Software package including vivado, vitis and petalinux as reference below, are available for program cycle.
Reference:
- Arty Z7 - Digilent Reference
- Getting Started with Vivado for Hardware-Only Designs - Digilent Reference
- Getting Started with Vivado and Vitis for Baremetal Software Projects - Digilent Reference
- Arty Z7 Out-of-Box Demo - Digilent Reference
One can choose either way to build the project from 0-1 bitstream alone or use Ready made IP, or skip to pure coding on Linux environment. This blog brief a general sketch on how it works. To save time, skipping the description of software installation and configuration parts, since it can be find in previous FPGA workshop blogs. As of Path to Programmable III Training Blog #2 Install Software and Petalinux - element14 Community
2 Getting start with Vivado
Start vivado and create new project,
add verilog file blink.v
module blink( input clk, output led4_b ); reg [24:0] count = 0; assign led4_b = count[24]; always @ (posedge(clk)) count <= count + 1; endmodule
then build and download to Arty Z7 kit
This can drive the output led4_b blinking. This can build AI projects too, if enough time is available. In most cast, use read made IP by vendor is much better.
Open another project in vivado,
Go step by step, until in last step Generate Bitstream ,this is where the bitstream files is build and ready to download into the Arty Z7 board,
Export the hardware platform is xsa file format. Then go to Vitis part
3 Getting start to Vitis
As of vitis 2024.1 version, vitis classic 2024.1 shall be used for Arty Z7 until further update for better compatible.
Import the xsa file and create hardware platform,
With this platform, C++ codes can perform kinds of jobs. Of course, AI project can be build in c++ as well. Much efficient than previous bitstream coding, while still time consuming. In fact, most commercial product use c++ coding for performance.
Below is same code blinking led.
#include "xparameters.h"
#include "xil_printf.h"
#include "xgpio.h"
#include "xil_types.h"
// Get device IDs from xparameters.h
#define BTN_ID XPAR_AXI_GPIO_BUTTONS_DEVICE_ID
#define LED_ID XPAR_AXI_GPIO_LED_DEVICE_ID
#define BTN_CHANNEL 1
#define LED_CHANNEL 1
#define BTN_MASK 0b1111
#define LED_MASK 0b1111
int main() {
XGpio_Config *cfg_ptr;
XGpio led_device, btn_device;
u32 data;
xil_printf("Entered function main\r\n");
// Initialize LED Device
cfg_ptr = XGpio_LookupConfig(LED_ID);
XGpio_CfgInitialize(&led_device, cfg_ptr, cfg_ptr->BaseAddress);
// Initialize Button Device
cfg_ptr = XGpio_LookupConfig(BTN_ID);
XGpio_CfgInitialize(&btn_device, cfg_ptr, cfg_ptr->BaseAddress);
// Set Button Tristate
XGpio_SetDataDirection(&btn_device, BTN_CHANNEL, BTN_MASK);
// Set Led Tristate
XGpio_SetDataDirection(&led_device, LED_CHANNEL, 0);
while (1) {
data = XGpio_DiscreteRead(&btn_device, BTN_CHANNEL);
data &= BTN_MASK;
if (data != 0) {
data = LED_MASK;
} else {
data = 0;
}
XGpio_DiscreteWrite(&led_device, LED_CHANNEL, data);
}
}
It is built in binary code and ready to be download to Arty Z7.
arm-none-eabi-size EyeOnOne.elf |tee "EyeOnOne.elf.size"
text data bss dec hex filename
24249 1176 22576 48001 bb81 EyeOnOne.elf
'Finished building: EyeOnOne.elf.size'
4 Build Petalinux Projects
Another choice is petalinux, with xsa hardware platform file and board overlay definition, petalinux project can be configurated and build into image file. Then coding is easy and same as any other linux coding. Free choice from C, C++, python, perl or any coding language within your hands.
The petalinux can only installed in linux platform and windows 10 is not supported. Windows WSL is virtual environment for linux, so be it.
5 Three Pathway to Eye Intelligence in Arty Z7
This blog list three technical pathway to AI intelligence for this Eye On Intelligence choice.
And missing one most important part, DPU. DPU is hardware accelerator IP for AI, it is built in bitstream file and can be integrated into overlay for programs to call the APIs. Without DPU, Arty Z7 can process image and person detection with other library, eg. libopencv, in lower performance for sure. Next blog, shall introduce DPU and how it works.