Creating and Building Example Vivado Project (BELK - BXELK) - DAVE Developer's Wiki
Creating and Building Example Vivado Project (BELK - BXELK) - DAVE Developer's Wiki
Info Box
In this document, the Vivado installation path may be Applies to Bora
indicated as vivado_201x.y. Just replace x and y with the
actual numbers of your version. For instance, use the
string vivado_2014.4 if you are working with Vivado Applies to BORA Xpress
2014.4.
Contents
History
Introduction
Command line based procedure
GUI based procedure
Downloading the bitstream to the device
Helloworld from UART0
History
BELK/BXELK
Version Date Notes
version
November
1.0.0 3.0.0 First release
2015
Updates for BELK 4.0.0 /
2.0.0 July 2017 3.0.0, 4.0.0
BXELK 2.0.0
Clarified U-Boot rebuild
requirement
2.0.1 (https://wiki.dave.eu/index.php?title=Creating_and_building_exampl Added Downloading the
September
e_Vivado_project_(BELK/BXELK)&oldid=9008) 3.0.0, 4.0.0
2019 bitstream to the device
section
December
3.0.0 4.1.0, 2.1.0
2019
Introduction
BELK/BXELK provides an example Vivado project for BORA/BORAX/BORALITE boards. This project allows to:
https://wiki.dave.eu/index.php/Creating_and_building_example_Vivado_project_(BELK/BXELK) 1/7
10/9/2020 Creating and building example Vivado project (BELK/BXELK) - DAVE Developer's Wiki
https://wiki.dave.eu/index.php/Creating_and_building_example_Vivado_project_(BELK/BXELK) 2/7
10/9/2020 Creating and building example Vivado project (BELK/BXELK) - DAVE Developer's Wiki
This article describes how two build this project. Two procedures are described, the former is command line based while the latter is GUI
based.
It is assumed that the Zynq development environment has been set up properly (see this page for more details).
export BASE_NAME=bora
export UBOOT_PS7_DIR=bora
export BASE_NAME=boralite
export UBOOT_PS7_DIR=bora
export BASE_NAME=borax
export UBOOT_PS7_DIR=borax
start the Zynq development server and login into the system
assuming that a local repository has not been created, clone the remote BORA git repository:
https://wiki.dave.eu/index.php/Creating_and_building_example_Vivado_project_(BELK/BXELK) 3/7
10/9/2020 Creating and building example Vivado project (BELK/BXELK) - DAVE Developer's Wiki
cd <bora_repo>
sudo cp -r boards/ /opt/Xilinx/Vivado/<Vivado_version>/data/
. /opt/Xilinx/Vivado/<Vivado_version>/settings64.sh
vivado -mode tcl -source scripts/recreate_prj_${BASE_NAME}_BASE.tcl -notrace -tclargs "gen_bitstream"
At the end of the bitstream build process, the build_prj_* script allows to automatically export hardware and lauch SDK.
The bitstream file is now present in <bora_repo>/vivado/${BASE_NAME}.runs/impl_1/${BASE_NAME}_wrapper.bit and
<bora_repo>/vivado/${BASE_NAME}.runs/impl_1/${BASE_NAME}_wrapper.bin.
By default FSBL is not used anymore in the boot process. U-Boot SPL (first-stage bootloader) is used instead. PS configuration files are
used to build U-boot binaries.
Copy the ps7_init_gpl.c and ps7_init_gpl.h source files into U-boot source code directory using the following command
example for Bora:
cp <bora_repo>/bd/${BASE_NAME}/ip/${BASE_NAME}_processing_system7_0_0/ps7_init_gpl.* <U-
boot_src_dir>/board/dave/bora/${UBOOT_PS7_DIR}/
Follow U-boot build instructions to build U-boot using new PS configurations. Please note that the U-Boot binary images
released along with BELK/BXELK were already built upon the ps7_init_gpl.c and ps7_init_gpl.h source files
generated by the Vivado project described in this article. As such, it is not generally required to rebuild U-Boot.
The PS configurations are the same for Bora and BoraLite boards.
export BORA_SOM=Bora
export BASE_NAME=bora
export UBOOT_PS7_DIR=bora
export BORA_SOM=BoraLite
export BASE_NAME=boralite
export UBOOT_PS7_DIR=bora
export BORA_SOM=BoraX
export BASE_NAME=borax
export UBOOT_PS7_DIR=borax
start the Zynq development server and login into the system
assuming that a local repository has not been created, clone the remote BORA git repository:git clone
[email protected]:dave/bora/bora.git
cd <bora_repo>
sudo cp -r boards/ /opt/Xilinx/Vivado/<Vivado_version>/data/
launch the Vivado Design Suite GUI with the following commands[c]:
. /opt/Xilinx/Vivado/201x.y/settings64.sh
vivado
https://wiki.dave.eu/index.php/Creating_and_building_example_Vivado_project_(BELK/BXELK) 4/7
10/9/2020 Creating and building example Vivado project (BELK/BXELK) - DAVE Developer's Wiki
this applies the default settings for BORA/BORAX and creates the I/O ports for the DDR and MIO pins
UART_0 and CAN_0 connections must be manually created:
right-clicking on each port (where mouse cursor switch to pencil) and selecting Make External or with keyboard shortcut
Ctrl+T. The name of the external ports must be UART_0 and CAN_0 respectively, otherwise correct manually
manually connect the FCLK_CLK0 signal to M_AXI_GP0_ACLK and save the block design
from the sources tab, select the BORA block design ${BASE_NAME}.bd as Design Sources and from the context menu select
Create HDL Wrapper
on the next window, select Let Vivado menage wrapper and auto-update and click OK
this creates the Verilog file ${BASE_NAME}_wrapper.v. If this file is not automatically included in the project, add it using the Add
sources option
cp
<project_directory>/<prj_name>.srcs/sources_1/bd/${BASE_NAME}/ip/<prj_name>_processing_system7_0_0/ps7_init_gpl.*
<U-boot_src_dir>/board/dave/bora/${UBOOT_PS7_DIR}/Follow U-boot build instructions to build U-boot using new PS
configurations. Please note that the U-Boot binary images released along with BELK/BXELK were already
built upon the ps7_init_gpl.c and ps7_init_gpl.h source files generated by the Vivado project described in
this article. As such, it is not generally required to rebuild U-Boot.
a. In a 32 bit system, Vivado settings are configured with the following command
/opt/Xilinx/Vivado/<Vivado_version>/settings32.sh
b. Passing the -tclargs "gen_bitstream" parameters allows for automatic building of the FPGA bitstream.
https://wiki.dave.eu/index.php/Creating_and_building_example_Vivado_project_(BELK/BXELK) 5/7
10/9/2020 Creating and building example Vivado project (BELK/BXELK) - DAVE Developer's Wiki
c. In a 32 bit system, Vivado settings are configured with the following command /opt/Xilinx/Vivado/201x.y/settings32.sh
Here below an example on C code for initializing and using UART0 through FPGA:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <termios.h>
int main()
{
int fd;
char *portname = "/dev/ttyPS1";
set_interface_attribs (fd, B115200, 0); // set speed to 115,200 bps, 8n1 (no parity)
write(fd, msg, strlen(msg));
https://wiki.dave.eu/index.php/Creating_and_building_example_Vivado_project_(BELK/BXELK) 6/7
10/9/2020 Creating and building example Vivado project (BELK/BXELK) - DAVE Developer's Wiki
exit(0);
}
The program executed print out the msg string on the serial console and on /dev/ttyPS1 port.
https://wiki.dave.eu/index.php/Creating_and_building_example_Vivado_project_(BELK/BXELK) 7/7