element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Eye On Intelligence Challenge
  • Challenges & Projects
  • Design Challenges
  • Eye On Intelligence Challenge
  • More
  • Cancel
Eye On Intelligence Challenge
Blog Person Detection with yolo #2 Software-->from Vivado to Vitis to Petalinux
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Eye On Intelligence Challenge to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fyaocn
  • Date Created: 7 Nov 2024 1:56 AM Date Created
  • Views 505 views
  • Likes 5 likes
  • Comments 1 comment
Related
Recommended

Person Detection with yolo #2 Software-->from Vivado to Vitis to Petalinux

fyaocn
fyaocn
7 Nov 2024

#2  Software-->from Vivado to Vitis to Petalinux

Table of Contents

  • 1 Diversity software toolsets
  • 2 Getting start with Vivado
  • 3  Getting to Vitis
  • 4 Build Petalinux Projects
  • 5 Three Pathway to Eye Intelligence in Arty Z7

1 Diversity software toolsets

Zybo Z7 is hardware platform

image

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,

image

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

image

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,

image

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,

image

Export the hardware platform is xsa file format. Then go to Vitis part

image

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,

image

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.

  • Sign in to reply
  • DAB
    DAB 8 months ago

    Nice walk through the process.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube