Chapter 6 Experience ARM, bare metal output “Hello World”#

From this chapter onwards, FPGA engineers and software development engineers collaborate to implement it.

The previous experiments were all conducted on the PL side. It can be seen that there is no difference from the ordinary FPGA development process. The main advantage of ZYNQ is the reasonable combination of FPGA and ARM, which puts forward higher requirements for developers. Starting from this chapter, we start to use ARM, which is what we call PS. In this chapter, we use a simple serial port printing to experience Vivado Vitis and PS side features.

The previous experiments are all things that FPGA engineers should do. From the beginning of this chapter, there is a division of labor. FPGA engineers are responsible for setting up the Vivado project and providing good hardware to software developers. Software developers can develop applications on this basis. . A good division of labor is also conducive to the advancement of the project. If a software developer wants to do everything, it may take a lot of time and energy to learn FPGA knowledge. Converting from software thinking to hardware thinking is a relatively painful process. If you just want to learn purely and have time, you can That’s another matter. Professional people doing professional things is a good choice.

Hardware introduction#

We can see from the schematic diagram that the ZYNQ chip is divided into PL and PS. The IO allocation on the PS side is relatively fixed and cannot be allocated arbitrarily, and there is no need to allocate pins in the Vivado software. Although this experiment only used PS, it still To create a Vivado project to configure PS pins. Although the ARM on the PS side is a hard core, in ZYNQ the ARM hard core must be added to the project before it can be used. The previous chapters introduced projects in the form of codes. This chapter begins by introducing ZYNQ’s graphical approach to building projects.

FPGA engineer job content#

The following introduces what FPGA engineers are responsible for.

Vivado project set up#

1) Create a project named “ps_hello”. The establishment process will not be described in detail. Please refer to “PL’s” Hello World “LED Experiment”.

  1. Click “Create Block Design” to create a Block design

../_images/image54.png

3) “Design name” is not modified here, keep the default “design_1”, you can modify it as needed, but the name should be as short as possible, otherwise there will be problems compiling under Windows.

../_images/image88.png
  1. Click the “Add IP” shortcut icon

../_images/image56.png

5) Search for “PS” and double-click “Control, Interfaces & Processing” in the search results list System”

../_images/image57.png
  1. Click Run Block Automation

../_images/image158.png
  1. Configure as follows, click OK

../_images/image159.png
  1. Automatic connection is as follows

../_images/image160.png
  1. Double-click CIPS to configure

../_images/image1611.png ../_images/image162.png

select PS PMC to config

../_images/image163.png
  1. Config QSPI,EMMC,SD

../_images/image164.png ../_images/image165.png ../_images/image166.png

Select the corresponding MIO

../_images/image167.png
  1. Check USB 2.0, GEM0, UART0, TTC, GPIO and other peripherals

../_images/image168.png

Configure peripherals

../_images/image169.png
  1. Configure MIO24 as GPIO input, corresponding to the PS side buttons, and configure MIO25 as GPIO output, corresponding to the PS side LED lights

../_images/image170.png ../_images/image1711.png
  1. In clocking, set the reference clock more accurately

../_images/image172.png
  1. Check all internal interrupts, the configuration is complete, and click OK

../_images/image173.png
  1. Click Finish

../_images/image174.png
  1. Double-click AXI NoC to configure DDR4

../_images/image175.png ../_images/image176.png ../_images/image177.png

select reference clock and system clock

../_images/image178.png

DDR Address Region 1, select NONE and OK

../_images/image179.png
  1. Modify pin name

../_images/image180.png

Double-click to configure the frequency of sys_clk to 200MHz

../_images/image1811.png
  1. Select the Block design, right-click “Create HDLWrapper…”, create a Verilog or VHDL file for blockdesign generates HDL top-level files.

../_images/image182.png
  1. Keep the default options and click “OK”

../_images/image183.png
  1. Add constraint

../_images/image184.png ../_images/image185.png ../_images/image186.png
  1. Generate Device Image

../_images/image187.png
  1. Cancel after completion

../_images/image188.png
  1. File->Export->Export Hardware…

../_images/image189.png ../_images/image190.png ../_images/image1911.png ../_images/image192.png ../_images/image193.png

At this time, you can see the xsa file in the project directory. This file contains Vivado hardware design information and can be used by software developers.

../_images/image194.png

At this point, the work of the FPGA engineer comes to an end.

Software engineer job content#

The Vitis project directory is “ps_hello/vitis”

The following is the responsibility of software engineers.

Debugging#

Create Application project#

  1. Create a new folder and copy the xx.xsa file exported by vivado.

2) Vitis is an independent software. You can double-click the Vitis software to open it, or select ToolsLaunch in the Vivado software. VitisOpen Vitis software

../_images/image91.png

On the welcome interface, click Open Workspace, select the previously created folder, and click “OK”

../_images/image195.png

3) After starting Vitis, the interface is as follows, click “Create Platform” Component”, this option will create a Platform project, which is similar to previous versions of hardware platform, including hardware support related files and BSP.

../_images/image196.png
  1. Fill in the Component name and path on the first page, keep the default, and click Next

../_images/image197.png
  1. Select (XSA, select “Browse”, select the previously generated xsa, click to open, and then click Next

../_images/image198.png
  1. Select operating system and processor, keep the default here

../_images/image199.png
  1. Click Finish to complete

../_images/image200.png
  1. After generation, a window interface appears. The following are some window introductions. They are similar to the previous version of Vitis interface, but the differences are also quite large.

../_images/image2011.png
  1. The platform can be compiled in the Flow window

../_images/image202.png

no error status

../_images/image203.png

10) Click Example on the left. There are many official routines here, which are similar to previous versions. Select Hello. World

../_images/image204.png
  1. Click to create project

../_images/image205.png
  1. Fill in the project name and path and keep the default

../_images/image206.png
  1. Select the platform

../_images/image207.png
  1. Click Next

../_images/image208.png
  1. Complete

../_images/image209.png
  1. Select hello_world and click Build

../_images/image210.png

Download debugging#

  1. Connect the JTAG cable to the development board and the UART USB cable to the PC

../_images/image2111.png
  1. Before powering on, it is best to set the startup mode of the development board to JTAG mode and pull it to the “ON” position.

../_images/image82.png
  1. Power on the development board, open the serial port debugging tool, and click Run in Flow

../_images/image212.png
  1. At this time, observe the serial port debugging tool and you can see the output “Hello World”

../_images/image213.png

firmware#

Ordinary FPGAs can generally be started from flash or passively loaded. The startup process has been introduced in the PMC architecture in Chapter 1 and will not be introduced here.

Select Create Boot in Flow Image, you can see the generated BIF file path in the pop-up window. The BIF file is the configuration file for generating the BOOT file, and the generated Output Image file path, that is, the BOOT.pdi file is generated. It is the startup file we need. It can be placed in the SD card for startup, or it can be programmed to QSPI. Flash.

../_images/image214.png ../_images/image215.png

The boot.pdi file can be found in the generated directory

../_images/image216.png

SD card boot test#

  1. Format the SD card. It can only be formatted to FAT32 format. Other formats cannot be started.

../_images/image217.png
  1. Put the boot.pdi file into the root directory

../_images/image218.png
  1. Insert the SD card into the SD card slot of the development board

  2. Adjust the startup mode to SD card startup

../_images/image219.png
  1. Open the serial port software, power on and start, you can see the printed information. The red box is the FSBL startup information, and the yellow arrow part is the executed application helloworld.

../_images/image220.png

QSPI startup test#

  1. In the Vitis menu Vitis -> Program Flash

../_images/image2211.png

2) Select the boot.pdi to be burned in the Image FIle file. Select Verify after flash, Flash Select qspi-x8-dual_parallel for Type, and verify the flash after programming is completed.

../_images/image222.png
  1. Click Program and wait for programming to complete

../_images/image223.png
  1. Set the startup mode to QSPI, start it again, and you can see the same startup effect as SD in the serial port software.

../_images/image224.png ../_images/image225.png

chapter summary#

This chapter introduces the classic process of Versal development from the perspectives of both FPGA engineers and software engineers. The main job of FPGA engineers is to build a hardware platform and provide hardware description files xsa to software engineers, who then develop applications based on this. This chapter is a simple example that introduces the collaborative work of FPGA and software engineers. It will also involve joint debugging between PS and PL later, which is more complicated and is also the core part of Versal development.

At the same time, FSBL, startup file production, SD card startup method, QSPI download and startup method are also introduced.