This page describes my process for bringing up the ZC706 with an Ubuntu 16.04 host.  This page is meant to describe the initial setup only, up until the point that I can get a Hello World running in Linux on the ZC706.  While going through this process, it seemed like there was some good documentation from Xilinx on how to do this (which I will point to later), but it failed to address some of the seemingly common pitfalls along the way.

Prerequisites

Before beginning this setup, we need the following items:

  • A host system with Ubuntu installed
    • I used an SC-6 Mini from Pico Computing, but other systems should work fine
    • I used Ubuntu 16.04
    • You will need root access for the host system
  • ZC706 Evaluation Kit
    • Comes with a node-locked license for Vivado
  • Vivado Design Suite
    • I used version 2016.3, but you can probably use the latest version
    • I installed the Vivado System Edition
  • PetaLinux Source and SDK
  • ZC706 BSP
    • Make sure your BSP version matches the PetaLinux version

Note that I’m running all my Xilinx tools on my host system; I use that same system to build bitfiles, compile Petalinux source, and talk to my ZC706 board.

Hardware Setup

The first thing to do is to connect up all your hardware from the ZC706 kit.  This was not immediately clear in the documentation, so I figured I would include a brief instruction in this guide.  Here is a photo of my board:

Photo Feb 09, 11 44 45 AM.jpg

The ethernet connection (bottom left) and the power plug (right) are completely obvious connections.  However, I found the JTAG and the UART connections to be a little ambiguous.  If you look closely at the board though, J21 is labeled as the USB UART (top left).  Also, after awhile closely scanning the silk screening on the the board, I did find a label for U30, which is the USB JTAG (middle left).

In my setup, I’ll use JTAG as my primary method for configuring the FPGA on the board.  Another way to do it would be to boot from an SD card, but that would mean a bit more complicated process every time I want to reprogram the board (remove the SD card, plug it into my computer, reprogram it, insert back into ZC706 board).  To complete the JTAG setup, I simply plugged the other end of this JTAG cable into a USB slot on my host.  Note that you do not have to use the Xilinx programmer (red box) in this setup.

My primary communication with Linux running on the ZC706 board will be over UART.  I’ll have a serial console running on my host (gtkterm is easy), so I plugged the other end of the UART cable into a USB slot on the host.

The ethernet connection can probably be considered optional for this setup, but it comes in really handy later when trying to get your own software to run on Linux (on the ZC706).  Therefore I plugged this ethernet cable into a port on my router.  The only thing that’s noteworthy here is that the host and board must be on the same internal network.

Note that there are a few things missing from my hardware setup:

  1. HDMI connection
    1. Since I’m going to be talking to this board over UART, I really don’t need a full-blown display at this time.
    2. It’s possible I’ll add a display in the future, but I’m trying to keep the setup as simple as possible to get started.
  2. SD card
    1. I somehow find myself lacking a computer with an SD card slot.
    2. Without an SD card slot on a computer (any computer), I can’t really program it.
    3. If I can’t really program the SD card, it’s basically useless to me (so don’t include it).
    4. If you prefer to boot from the SD card, you’ll obviously need this in your setup.

Board Switches

Before powering up the board, I had to set a couple of switches, which are dependent upon your system configuration.  In my case, I wanted to:

  1. program the device over JTAG (without a Xilinx programmer)
  2. boot the Zynq from JTAG

Note that when trying to set these switches, I found the Xilinx ZC706 Evaluation Board User Guide to be super helpful.

For the first setting, I had to set SW4.  Table 1-11 in the user guide was helpful for that.

sw4_table

In my case, I wanted to use the Digilent USB-to-JTAG interface for programming the device.  This eliminates the need for a Xilinx JTAG programmer.  I therefore set SW4 as shown in the following image.

photo-feb-13-9-27-22-am

That takes care of being able to program the FPGA over JTAG, but I still need to specify that  I want to boot over JTAG as well.  For that, I turned to Table 1-2 in the user guide.

sw11_table

According to the table, I needed to set my SW11 for JTAG mode, which I did as shown in the figure below.

photo-feb-13-9-26-24-am

At this point, it was finally time to fire up my host system and turn on my board!

Drivers

At this point, I had my hardware setup complete, but I still needed some drivers to talk to the board.  This is what I needed:

  1. JTAG – for programming the FPGA and booting Linux
  2. UART – for talking to the board from the host once Linux has booted

For this section, I again found the Xilinx ZC706 Evaluation Board User Guide to be super helpful.

The first driver that I had to install was for the Digilent USB to JTAG module on the board.  Note that you may have already installed this driver (when you installed Vivado).  In case you did not (like me) or in case you want to re-install them, I found Answer Record 59128 to be quite helpful.  In that Answer Record, it says that the cable driver install is always copied to the Vivado install location.  I therefore just navigated to the specified directory and ran the script, as shown below.  Before running the install script, I first disconnected the JTAG cable from my host system.

xilinx_cable_driver_install

After running the install script, I re-connected the JTAG cable to my host system.  I then ran the command usb-devices from the command line in a terminal to see all the devices connected to my computer.  I found my Digilent USB Device, and I saw that it was associated with the appropriate driver.

ftdi_usb-devices

Next, the USB-to-UART Bridge section in the User Guide discusses the critical information for the UART that I used.  It recommended finding the drivers for the CP2103GM on the Silicon Labs website.  Silicon Labs seems to support many different bridges with their CP210x driver.  I downloaded the 3.x.x version for Linux.  I then simply followed the install process, which is described in the downloaded CP210x_VCP_Linux_3.13.x_Release_Notes.txt file, as shown below.

cp210x_build

After installing, I used the usb-devices command from the command line to see the list of devices and any drivers currently in use for that device.  Scanning through the list, I found my CP2103 USB to UART Bridge Controller, as shown below.

cp210x_usb-devices

That wrapped up the drivers that I used for talking to my board, but I still needed a graphical display to talk to the UART.  At first, I used screen, which is super easy to setup and get started with.  However, I eventually turned to gtkterm.  This was super easy to install from the command line, and the configuration was pretty straightforward.

Before launching gtkterm, I first needed to run the following commands.  These created a new group (dialout), added my username to the group, changed the group ownership for the JTAG and USB-to-UART devices to the newly created dialout group, and gave the dialout group read and write permissions for those devices.

sudo groupadd dialout
sudo useradd -G dialout 
sudo chgrp /dev/ttyUSB* dialout
sudo chmod g+rw /dev/ttyUSB*

Now that my username could read and write the USB devices, I fired up gtkterm from the command line.  Don’t worry about any command-line arguments for the initial configuration.  Once gtkterm opens, click on Configuration->Port in the menu.  This will bring up the following window.  Here we need to configure gtkterm to talk to our USB to UART bridge.  In my case, my USB to UART bridge was on ttyUSB1.  Yours might be different, so be sure to look (i.e. run usb-devices from the command line).  Set the baud rate to 115200 and click Ok.  You can also save this as the default configuration to make it load next time you open gtkterm (Configuration->Save configuration).

gtkterm_config

Useful Links

Before I dive too much more into PetaLinux, it’s important to know that I don’t have all the answers here (believe it or not).  Instead, I highly recommend these links for answers to hardware and PetaLinux questions that you may have.

Here are some more links for PetaLinux documentation, though I did not find them as helpful.

Prebuilt Design

After powering up the board and installing the drivers, I wanted to verify that the hardware was working correctly.  Thankfully, Xilinx provides some pre-built designs, which should let you verify the hardware on its own.  For this section, I found the PetaLinux Getting Started Guide to be particularly useful.

Before testing the pre-built design, I needed to install the reference BSP for the ZC706, as mentioned in the Getting Started Guide (see Install PetaLinux Reference BSP section).  Whenusing PetaLinux, the first thing to do is usually to source the PetaLinux setup script.

source <petalinux install dir>/settings.sh

That install script sets up your $PATH and the $PETALINUX environment variables.  I also like to copy my downloaded BSP to my PetaLinux installation directory, because I’ll likely be using this a lot in the future, and it seems best to create a new project based upon this BSP.

sudo mv ~/Downloads/Xilinx-ZC706-v2016.3-final.bsp $PETALINUX

Now that we have the BSP in a safe, known location, we can create a new project from that BSP.  Note that this part is described in the Install PetaLinux Reference BSP section of the Getting Started Guide.  I was a little confused about calling this an installation process, because it needs to be done for every new project.  Therefore I like to think of this as a project creation step.

petalinux-create -t project -s $PETALINUX/Xilinx-ZC706-v2016.3-final.bsp

This will create a new project in the current working directory with the name Xilinx-ZC706-2016.3.

After this step, we can now test the pre-built image.  The Getting Started Guide covers this pretty well in the Test a Pre-built PetaLinux Image section. In my case, I cared about the Boot Pre-built Images with JTAG subsection.

First, I open my gtkterm console, so I can see what happens after Linux boots.  Note that gtkterm should open with my correct default settings already in use (see above).  The console will be blank at the beginning, but you’ll see some text during the boot process.  After opening gtkterm, I navigate to the newly created project directory.  I then run the petalinux-boot command to program the FPGA with the pre-built design, download the pre-built Linux code to the board, and run the FSBL (followed by u-boot and finally the kernel).

cd <project creation dir>/Xilinx-ZC706-2016.3
petalinux-boot --jtag --prebuilt 3

Here’s what that process looks like in the terminal.

booting_petalinux_terminal

Now here’s what it looks like in gtkterm.

booting_petalinux_gtkterm

Once Linux has booted, you should see a login screen in gtkterm.

petalinux_login_screen.png

The login username is root and the password is root.  After you have successfully logged in, you’ll see a normal Linux command line interface.  Feel free to browse around a little bit.  Try a text editor if you like (vi is included), or even see if your network interface is working (ifconfig).

If you got to this point, Congratulations!  Your hardware is up and running!

If not, leave a comment on this page.  Let me know which part tripped you up.

Now that your hardware is up and running, you probably want to do something cool with it.  That’s the whole reason you got this dev board, right?  Be sure to check out my next blog post, which walks through modifying/rebuilding the hardware, as well as modifying/rebuilding the Linux image.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s