Ece 315 Computer Interfacing Lab #0: Tutorial On The Digilent Zybo Z7 Board and The Freertos Real-Time Kernel
Ece 315 Computer Interfacing Lab #0: Tutorial On The Digilent Zybo Z7 Board and The Freertos Real-Time Kernel
Objectives
• To verify that your hardware and software environments are working properly.
• To gain familiarity with the Digilent Zybo Z7 Zynq-7000-based board.
• To gain experience with using the Xilinx Vivado and SDK tools.
• To gain some initial experience with the FreeRTOS real-time kernel.
Documentation
• Three HOWTO Vivado installation guides in the Lab References Section of the lab eClass
page (titled "ECE 315 Winter 2022" on eClass). There are installation guides for three
possible host PC operating systems: (a) Microsoft Windows 10, (b) Linux, and (c) Apple
MacOS. Versions of the Vivado tools are available that can run natively in both Windows
and Linux. Note that a MacOS installation of Vivado first requires that a free copy of the
virtualization software VMware be obtained from the site
ualberta.onthehub.com and installed on your Mac. Then a lightweight version of Linux,
called Lumbuntu 16.04 LTS, must be installed and executed as a virtual machine in
Prelab Work
The 2019.1 version of the Vivado design package, including the Software Development Kit (SDK),
must be installed on your host computer before starting Lab #0. The instructions for installing
Vivado 2019.1 are given in HOWTO handouts on the eClass site for the Microsoft Windows 10,
Linux and MacOS host operating system environments. You will need about 77 Gbytes of free
storage on a Windows or Linux host (100 GB on a Mac) to complete the installation. However,
once the installation is finished, the remaining installed binary code will be about 30 GB (more
on a Mac, which also requires VMware and the Lubuntu virtual machine).
As a standard precaution, be very careful when you handle circuit boards. If possible, wear a
grounded wrist strap when you are handling a circuit board. Avoid wearing rubber soled shoes.
Avoid touching exposed conductors and the pins in connectors and headers. Get in the habit
of touching a nearby grounded conductor before you start handling a circuit board.
Laboratory Exercise Instructions
Step 1: Do not connect the Zybo Z7 just yet to your PC. Download the zipped project directory
from the Tutorial Lab section of the Laboratory eClass site ("ECE 315 – Winter 2022") and unzip
the folder at a convenient location (say a lab0 subdirectory) in your personal computer. From
the unzipped folder, open the Tutoriallab_ECE315 project file using Vivado 2019.1.
Step 2: Click on the Open Block Design command in the IP Integrator section of the Flow Navigator
Window at the left side of the Vivado desktop window, as highlighted in yellow in Figure 1. This
action will cause a block diagram of the pre-designed Zynq-7010 hardware configuration for the
tutorial lab to be displayed.
Step 3: Next, click on the Generate Bitstream command in the PROGRAM AND DEBUG section of
Flow Navigator Window. Select Yes in the pop-up window for Synthesis. Next click OK in the
Launch Runs pop-up window.
Step 4: Once the bitstream is successfully generated, a Bitstream Generation Completed window
will open. Click Cancel. Under the File pull-down menu, select the Export Hardware command, as
shown below in Figure 2. The pop-up Export Hardware window will open. Check on the Include
bitstream option and leave the remaining settings with their default values. Click on the OK
response. The hardware design files that are required for software development in the SDK tool
are now generated.
Step 5: The hardware design is now exported into the SDK software development tool. Note that
the task application code appears as functions within a program that forms the FreeRTOS
software system. Start SDK by selecting Go to File -> Launch SDK.
Step 6: The Xilinx SDK desktop window will now open and you must wait for the initialization
process to finish. You will soon see the populated SDK windows appear, as shown in Figure 3. The
exported hardware design appears in the folder “design_1_wrapper_hw_platform_0” in the
Project Explorer pane at the left side. You will recognize a number of .c C files and .h header files
PART-1:
Step 7: Click on the File->New->Application Project command, as shown in Figure 4. Enter the
project name that you want to use. Under the OS Platform drop-down menu, select
freertos_10_xilinx to add the FreeRTOS kernel to the software system. Leave the other selected
choices at their default values and click Next. Leave the default template as FreeRTOS Hello World
and click Finish.
It is common to include a "Hello World" tutorial example in software design environments such
as SDK. Such an example demonstrates to new users how a minimal software program can be
compiled, downloaded to the target hardware, and executed to produce a simple output
message. More complicated software programs can then be developed by modifying and growing
the Hello World example. Trying to create a brand-new working "Hello World" example from the
documentation would take a long time for a new user.
Step 8: After the workspace build is done, two new folders will appear in the Project Explorer
Window. In Figure 5, note the appearance of helloworld and helloworld_bsp. Expand the
helloworld subfolder and open the source file freertos_hello_world.c. Replace this code with the
helloworld.c file that was provided to you on eClass and save the changes. When executed later
in Step 10, this tutorial lab code will print the message …Hello World… into the console window
(at the bottom of the desktop) four times at an interval of 1 second.
Step 9: It is now time to connect the FPGA board. The Zybo board can be powered using the
micro-USB cable or from the external power supply. Jumper JP6 located near the ON/OFF switch
needs to be adjusted based on the power supply being used. The first method uses the micro-
USB cable as shown in Figure 6. This micro-USB cable will supply the power as well as providing
JTAG-UART connection from the PC to the board. Set the Jumper JP6 to “USB” in this case. The
second method involves using the external power supply as illustrated in Figure 7. Here, the
micro-USB cable will only serve the purpose of establishing a JTAG-UART connection. Set the
Jumper JP6 to “wall”.
You have been provided with the external power supply adapter, however, the board can receive
sufficient power over the USB cable.
Turn ON the power switch and you should see a red light on LD13, as shown in Figure 8. Now, to
establish serial communication with the board, click on the SDK Terminal tab in the bottom
window of the Xilinx SDK, as shown in Figure 9. Click on the + icon on the top border of the SDK
Terminal window and a pop-up Connect to serial port window should open. In the Port pulldown
menu of the pop-up window, select the COM terminal on your PC to which the micro-USB cable
from your Zybo Z7 board is connected. Leave the other settings at their default values, including
the baud rate of 115200. Click OK.
Figure 7: Supplying Power to the Zybo Board Using a Cable to the Power Supply
Double-click on the Xilinx C/C++ application (System Debugger) command. In the same window,
on right side check the boxes for Reset entire system and Program FPGA. Make sure that the
remaining settings are left with their default values, as shown in Figure 11. Under the Applications
tab, verify that the ps7_cortexa9_0 checkbox is selected, the Project Name is correct (that is, the
project name that you chose in Step 7) and the Application field has the .elf file type mentioned.
The file type .elf stands for Executable and Linkable Format, which is a widely used file format for
encoding binary files for embedded systems. Click on Apply-> Run to produce the following
sequence of actions: (1) a board reset, (2) downloading the hardware configuration to the Zynq-
7010 SoC, (3) downloading the compiled software to the DDR3 memory on the Zybo Z7 board,
and (4) executing the software on the Cortex A9 processor that is designated
"hardware_platform_0", which is associated with CPU0.
You should now see that once the application begins to run, the DONE LED (LD12) turns green on
the board, and serial messages produced by the xil_printf() statement in the software will be
displayed in the SDK terminal window.
Step 11: Now modify the xil_printf statement that is in a commented section in the code. For
instance, change the statement to include your name. Re-run the application by clicking on Apply
-> Run and confirm the difference in the serial message are now being printed.
PART-2:
This part creates two FreeRTOS tasks, one responsible for blinking the BLUE LED and the other
responsible for blinking the YELLOW led using the RGB LED (LD6 on board). The BLUE task runs
and goes into a delay (i.e., it is deliberately blocked and is waiting for the delay period to finish)
for 1.5 sec. The YELLOW task runs and then goes into a delay period for 2.5 sec. If there is a case
where both the tasks come out of delay state at same instance, BLUE task will run first compared
to YELLOW task as BLUE task has highest priority. In this exercise, you will be responsible for
changing the RGB LED colors on board. By default, one task is assigned a blue color and the other
is assigned a yellow color. Download the gpio_tasks_leds.c file from the eclass. Rest of the color
definitions are provided at the top of the code file. Modify the C code under the commented
section of the file to change the color of your choice.
Step 13: The Zybo Z7 board must be turned ON and the serial connection should be established
as mentioned in the above steps. Run this project in the same manner as before. You should now
see the RGB LED display and blink the colors blue and yellow. On the serial terminal you will see
the messages being printed that identify the task function that is currently being executed.
Go ahead and try to display different colors using the definitions provided in the code file and by
changing the xil_printf statements accordingly.
Report Requirements
No report is required for this tutorial lab exercise.
Marking Scheme
This lab is not worth any marks. However, it is important that you complete this lab exercise if
you wish to succeed on the subsequent lab exercises, which are all graded and worth marks.