03fpga开发之使用SDK进行FLASH固化
03fpga开发之使用SDK进行FLASH固化
03fpga开发之使用SDK进行FLASH固化
1
Machine Translated by Google
Table of contents
4. Create a new FSBL SDK project and FPGA solidification............ ................................................... ................................
2
Machine Translated by Google
This document realizes that the bit stream generated by the design is solidified into the FLASH of the FPGA startup configuration. After curing, the bit file can be automatically configured after power-on
, will not be lost when power off. This document is aimed at projects with only FPGA code. If it involves ARM software code downloading, the following tutorials will
There are special chapters for supplementary study. For SD card booting, the method is similar. The following tutorials will explain in detail separately. For how to create a new project, please refer to
Document "Development Software Installation and Introduction/Introduction to VIVADO and Tutorial for New ZYNQ Project under the Software".
Package->clg400
Speed->7010 selection-1,7020
Click Next->
NewProjectSummary (new project overview) Confirm project information, type selection, etc., click Finish to complete
We know that there is an ARM processor inside the zynq chip. When the power is turned on, ARM runs a piece of startup code
to assist in configuring the FPGA, and if there is software code, it can run the software code at the same time after the configuration is
completed. Therefore, we need to use the ARM processor module in the ZYNQ chip. On the ZYNQ chip, there is a processor module
called ZYNQ7 Prosessing System module. This module is the processor core of ZYNQ. Like the modules of DSP, gate circuit, and
adder, this hardware can be directly called through IP. Through this hardware call, we can use this processor conveniently, and then
use the XILINX software development environment (SDK) to create a new processor software boot code to complete the FPGA
configuration of ZYNQ. The boot code can be realized by creating a new project template. No need to write code yourself. Finally,
package and burn the executable file and BIT file after the boot code is compiled to FLASH to complete the functions we need.
First, we create a new bd file in the newly completed fpga_03_fpga_flash_dowload project. We click Create Block Design under
IP INTEGRATOR in the project management bar to create a bd file. The Bd file can be used to chart and schematic diagram the FPGA
3
Machine Translated by Google
After the creation, we can see our newly created bd file in the sources.
By default, the Diagram window will appear after creating a new one. If it doesn't appear, double-click the bd file to open it. We click
4
Machine Translated by Google
After clicking +, in the pop-up IP core option, we enter ZYNQ in Serach to see what we need to use
ZYNQ System-on-Chip:
5
Machine Translated by Google
Then we double-click the ZYNQ module to open the IP configuration. As you can see from the configuration interface, this IP is very
complicated, and there are many things that need to be set. Here we do not explain the configuration function in detail. We only need to configure
it as a minimum processor system, and set the FLASH pin storage of the chip, and turn off other unnecessary ones. We will explain the
6
Machine Translated by Google
First of all, in the general of PS-PL configuration, pull down to find enable clock resets, expand it, and set the first
Check it out, and check off the M AXI GP0 interface of the GP Master AXI Interface under AXI Non Secure
Enablement:
7
Machine Translated by Google
Then, in peripheral I/O Pins, select Quad SPI Flash and check the first item:
MIO Configuration, expand Memory interfaces->Quad SPI Flash->Signle SS 4-bit IO, set
8
Machine Translated by Google
Finally, we configure the DDR3 memory controller, the model we choose MT41J256M16 HA-125, the bit width is 16 bits,
Be sure to check that the bit width is 16! If it is 32 and cannot run, our physical DDR3 is 16 bits:
9
Machine Translated by Google
Finally, we click OK to exit the IP configuration. We can see that the ZYNQ interface in Diagram is much less, only DDR and FIXED_IO are left. Then,
we click on the blue font Run Block Automation on the top of the Diagram file basket on the way:
10
Machine Translated by Google
Finally, the IP in the generated module diagram becomes the state of leading out DDR and FIXED_IO.
11
Machine Translated by Google
We click the maximize in the middle of the upper right corner of the Diagram to maximize the icon window (there is a mark in the upper right corner of the above picture
Note), and then click the symbol with a tick in the small box of the symbol tool above the chart document to check the chart:
Finally, the check result dialog box pops up, indicating that the design is correct, and we click OK to close:
Then, we find the file management bar. Click Sources at the top left of the Diagram icon:
12
Machine Translated by Google
Then right-click Generate Output Products on the bd file to generate output related files. The output file includes
The Generate IP Output File dialog box pops up. By default, click generate and wait for the generation to complete:
13
Machine Translated by Google
Let's go back to the file manager again, right click on the bd file, click Create HDL Wrapper, and generate the top-level interface
The HDL file of the mouth, this file is our top-level module HDL file.
14
Machine Translated by Google
Since the ZYNQ processor call is to directly call the module, we also need the HDL top-level file automatically generated in the project
Instantiate our FPGA code. We add breath_led.v in the fpga_02_breath_led routine to the project. We add our breath_led.v file by right-
clicking Add Sources on Design Sources in the Sources column. When adding, you can choose to copy to the project:
Finally click Finish to complete the addition. We can see that the source file of the file navigation bar is as shown in the figure:
Let's instantiate the modules in breath_led.v to design_1_wrapper. First, the top-level signal interface adds three signals of
breath_led, clk, rstn, led, and then adds the type declaration of the signal. Finally, add an instantiation of the breath_led module at the
15
Machine Translated by Google
After the completion of the module physics and chemistry, it needs to be synthesized first! Remember to synthesize first, remember to synthesize first! ! Otherwise, no new pin binding can be found
Added interface signal! ! Please be careful! ! Say important things three times! !
After the first pass of synthesis, the pins need to be bound. Binding pins is in the Open elaborate design under RTL ANALYSIS in the
project management bar. After entering, switch the view to I/O planning. For detailed operations of binding pin constraints, please refer to the led
running water light tutorial developed by 01_fpga. The pins are also consistent, and the level standards are all LVCMOS3.3. We only need to restrict
the external interface of the breath_led.v signal that is instantiated, and we don't care about the other signals and the interface of zynq.
16
Machine Translated by Google
Synthesis, place and route, generate bit files, and wait for completion. Click Cancel when finished:
17
Machine Translated by Google
In the dialog box that pops up, check Include bit files.
In the previous section we derived a hardware description. This derived hardware description describes the relevant configuration of a processor
document. Then, we started to use the exported hardware for the next step. Let's go back to the main interface of the software, click File->Launch SDK on the top
toolbar to start VIVADO's SDK development software. After startup, the SDK will automatically import the customized
18
Machine Translated by Google
The processor hardware description engineering code. We don't care about it and wait for the SDK to start and import to complete.
After clicking Start SDK, the pop-up dialog box clicks OK by default:
19
Machine Translated by Google
After startup, we can see a code project describing the hardware. We don't need to make any changes to this project. The
We create a new startup boot project in the SDK: File->New->Application on the toolbar at the top of the SDK
Projectÿ
In the pop-up interface, we fill in the project name as fsbl, and then leave the rest unchanged by default, and click NEXT:
20
Machine Translated by Google
Next, we select the Zynq FSBL project template, and finally click Finish to complete.
Finally, we can see that there are three projects in the project directory on the left side of the SDK, which are the hardware description project and the fsbl startup guide
21
Machine Translated by Google
At this point, we are ready to make the FPGA startup configuration file and solidify it to FLASH.
We click XILINX->Create Boot Image in the toolbar above the SDK, and we start to make the ZYNQ boot image
Dynamic BIN file (the prepared BIN file contains the BIT file that our FPGA needs to solidify)
Then, on the pop-up interface, we configure the Output BIF file path to output the path of the generated bif file as shown in the figure. We
click Browse, and save it to the debug path of the project by default:
22
Machine Translated by Google
After saving the path, the Output path is also under this path by default. Output path is the output
Next, we add the files. First, we add the executable file generated by the fsbl startup boot code, that is, the arm executable file
23
Machine Translated by Google
Click browse in the pop-up dialog box to select and note that the Partition type defaults to bootloader:
24
Machine Translated by Google
Then back to the situation we have added the fsbl file path. Click OK:
Then add our bit file in the same way. The path is in this project:
fpga_flash_dowload_project\fpga_flash_dowload_project.runs\impl_1
25
Machine Translated by Google
In general, to make a bootable BIN file, add the fsbl.elf file (bootloader) first, and then add the bit file (datafile). If there is a software arm code app
application, then add an app.elf (datafile). This project only has FLASH solidification developed by FPGA, and there is no application program, so only these
two files are needed. You can see that there are two files in the list and click Create Image:
At this point, the BIN file for starting the FPGA for curing is ready. We set up the DIP switches next. development board
There are three BOOT modes that can be set, corresponding to the following:
26
Machine Translated by Google
There is a BOOT setting table on the back of the development board, which provides two references of SD and QSPI. In fact, there are NAND memory
settings, but our board does not have NAND, so we will not write it out, and the JTAG mode is not commonly used. For more detailed dial settings, please refer to
We start to solidify. Set the DIP switches to 00, that is, JTAG mode. Attention, set in power-off state!
After setting the BOOT dial switch system, connect the computer and power on. Plug the USB cable of the DEBUG interface to the computer on the development board,
and wait for about ten seconds, because it takes a while to recognize the download cable connected to the computer. Back to the SDK, we click on the toolbar, click
The Image file is the BIN file we just generated, and the FSBL is the FSBL.elf we just selected. Then wait for the FLASH operation to complete.
27
Machine Translated by Google
Note, after the programming is completed, be sure to power off and reset the BOOT DIP switch, which is the following mode:
Then we power cycle the development board. You can also press the reset button if operating with power on. Sometimes JTAG is connected to computer VIVADO
software or SDK software, which may cause startup failure. Everyone unplug the data cable of the DEBUG port, switch to the other two USB ports for power supply, and then
In addition, the sdk programming is very slow, and it is not easy to use. You can refer to "ZYNQ Several Debugging Skills Extended Tutorial" to learn
1. Burning cannot succeed. Solution: Check the DIP switch, set all to 00, that is, ON state; then turn off the power and turn on the switch again to
connect to the computer. Still can’t be programmed, check the configuration of ZYNQ’s PS, the key part is the QSPI pin configuration, as well as the model and
2. Unable to run after programming: Please check whether it is set to QSPI after programming and then power off and restart.
3. The programming progress bar stops moving. In this case, if no programming error message is output, it is normal. because
28
Machine Translated by Google
The FLASH erase may take several minutes. Nothing to do with downloader speed. please wait patiently.
4. Programming can also be started using TF. Set the SD0 interface of the ZYNQ processor, make a BIN file, and finally
Copy directly to the memory card formatted as FAT32, set the BOOT dial to 11 (TF card boot mode). A 16G high-quality card is recommended.
29