About a month ago my group purchased the Xilinx Zynq-7000 SoC ZC702 Evaluation Kit, featuring the ZC702 SoC board. Far from being trivial, getting the SDK and the framework (ISE Design Suite 14.x + ARM Tools) to work properly in a stable environment is quite challenging. In this post I will go through the different alternatives, describing the pros and cons I considered. I will also propose a mixed set-up combining 2 virtual machines, as well as a step-by-step guideline for it. This configuration is actually the one I am using for programming the ZC702.
#Alternatives
Xilinx ISE Design Suite is the framework provided by Xilinx to compile (and cross-compile) most of the components necessary to program their boards. According to ISE Design Suite’s release notes guide (here), supported operating systems are:
- Windows (XP Professional, 7 Professional), (32/64)-bits, English/Japanese
- Windows Server 2008, 64-bit
- Red Hat Enterprise Workstation 5, (32-64)-bit
- Red Hat Enterprise Workstation 6, (32-64)-bit
- SUSE Linux Enterprise 11, (32-64)-bit
Unfortunately, not everything can be done with ISE Design Suite (e.g. cross-compile a kernel image to match and arm architecture). For this reason, Xilinx getting started guide (here), describes as a requirement to count on a Linux Development PC with the ARM GNU tools installed. Interestingly though, ARM GNU tools (specially 64-bit) are known to need some packages such as ia32-libs, which can more easily be found in Debian package manager (apt). Moreover, qemu (an open source machine emulator), which can be very useful when developing for cross-compiled platform, has known issues with Xilinx version of Red Hat (here).
Therefore, the “straight” possibilities, if wanting a full developing environment are:
- Red Hat Enterprise Work Station. This means that we will encounter some problems installing ARM GNU tools (can be solved), and we will not be able to use qemu’s full functionality (this is a known issue which can take a long time to solve). Also we will have to purchase a license, since Red Hat is a commercial Linux distribution. To my knowledge Red Hat does not count on an University Program that allows free, unsupported versions of their operating system (I can be wrong here). Finally, and this is a matter of taste, if you are used to Debian (Ubuntu is a Debian), then moving to a different distribution can be… challenging.
- SUSE Linux Enterprise 11. Once again, this means we will encounter some problems installing ARM GNU tools (can be solved), but qemu does not report any known issues here. However, in this case a license is also required. Please note that openSuSe is a free alternative. Finally, SUSE is not Debian, which can also bring complications to Debian-accustomed users.
#My solution
After this small research, one has to decide. In my personal case, I wanted to stay with a Debian distribution (Ubuntu), which implies that ISE Design Suite is not supported. I spent 3 days full time trying to make it work. However, even when I was able to solve most of the dependency issues, a compilation error I thought to take way-too-much time to solve, made me change my mind. (Here -TO COME- are the problems I found and how I solved them. Maybe you are more capable than me, and are able to make ISE run under Ubuntu :)). This proved to be the right move, specially when after installing ISE Design Suite in a Windows environment, all problems where gone – that simple. I decided then to use both Ubuntu and Windows as my working environment.
Before describing my set-up, I would like to mention that, in my experience, environments used for cross-compiling to embedded systems are highly sensitive to changes. This is mainly cause by the number of dependencies and custom made parts of software. For this reason, I always use virtual machines that I clone when the environment is set up. In this way, if something goes wrong, I can always come back to a working environment and continue working (keeping git + a regular VM backup simply works :)). My set-up was then (32-bit is chosen because of complications with ARM GNU tools and 64-bit systems):
- MacOS + Parallels Desktop (Virtual Box works equally good. This is just a matter of taste. Also, the kind of taste that implies a license…but anyway). My workspace is in my MacOS file system, where both VMs can read/write, being just a matter of switching VM depending on the task. Check if your system allows you to boot both VMs simultaneously without performance implications.
- Windows 7 Professional 32-bit VM. Please note that Microsoft counts on a University Program that allow students and staff to download legal Microsoft products.
- Ubuntu 12.04 LTS 32-bit VM.
#Setting up Windows and ISE Design Suite
Setting up ISE Design Suit in a Windows machine is dead simple. There is a guideline that can be followed (here). The main points are here:
- Download the ISE Design Suite (here)
- Double click on xsetup.exe and follow the instructions. Select ISE Design Suit System Edition or Embedded Edition
- Set up environment variables.
- Start Menu > All Programs> Xilinx Design Tools > ISE Design Suite 14.4 > Accessories > ISE Design SUite 32 (or 64) Bit Command Prompt.
- Add <XILINX installation directory>\settings32.bat or settings64.bat to your script.
The Xilinx Design Tools are ready to use.
#Setting up Ubuntu
We are going to use Ubuntu for cross-compiling to our target platform (zynq-7000). This will allow us to use our Ubuntu machine as a developing host machine, and at the same time compile binaries (e.g. linux kernel, bootloader, etc) that can execute in our XIlinx board (This applies to any board).
We are going to start with the ARM GNU Tools:
- Download the tools from this link as part of the Xilinx Software Development Kit (ARM GNU Tools). Choose the Full Installer for Linux.
- Install the ARM GNU Tools:
- cd <Xilinx_ISE_DS_Lin_14.x directory>/CodeSourcery
- xinstall/mnf/ise_0063.mnf
- Follow steps and install in /opt/CodeSourcery. Remember the installation path otherwise.
- cd <Xilinx_ISE_DS_Lin_14.x directory>/CodeSourcery
- Update PATH:
- echo ‘export CROSS_COMPILE=arm-xilinx-linux-gnueabi-‘ >> ~/.bashrc
- echo ‘export PATH:$PATH:/opt/CodeSourcery/Sourcery_CodeBench_Lite_for_Xilinx_GNU_Linux/bin’ >> ~/.bashrc (Please note that if you did not select /opt/COdeSourcery in step 2, you should change that part of the path here yo you own installation directory. Also, note that depending on the CodeBench tools you are using, the install path might be slightly different.)
We most likely want to be able to carry our some debugging. For this, we install a serial terminal. My favourite is cutecom, but there are others: minicom, screen, etc. For installing it:
- sudo apt-get install cutecom
We also need to change the rights of the device port we are read/write from:
- Connect the board UART connector to your USB by using a serial usb converter
- sudo dmesg | grep /dev/ttyUSB Most probably it will be /dev/ttyUSB0. Remember otherwise
- sudo chmod 666 /etc/ttyUSB0 Or any other you might have got in the step before.
Finally, for some steps (not all of them) it is necessary to install the Xilinx cable drivers. They should be a part of the ISE Design Suite, but if you try to install them in Ubuntu (or any other Debian) you will get an error. To install the cable drivers:
- Install necessary tools:
- On 32-bit: sudo apt-get install gitk git-gui libusb-dev build-essential libc6-dev fxload
- On 64-bit: sudo apt-get install gitk git-gui libusb-dev build-essential libc6-dev-i386 fxload
- sudo mkdir /opt/Xilinx If you do not have installed the ISE Design Suite in you Ubuntu machine
- cd /opt/Xilinx
- Clone the usb-driver git repository
- sudo git clone git://git.zerfleddert.de/usb-driver
- cd usb-driver
- Make:
- On 32-bit: sudo make
- On 64-bit: sudo make lib32
- Set up the driver
- ./setup_pcusb /opt/Xilinx/13.2/ISE_DS/ISE/
- If you have ISE installed, set up up again and modify PATH:
- source /opt/Xilinx/14.4/ISE_DS/setting32.sh (or setting64.sh if using 64-bit)
- On 32-bit: echo ‘export PATH=$PATH:/opt/Xilinx/14.4/ISE_DS/ISE/bin/lin’ >> ~/.bashrc
- On 64-bit: echo ‘export PATH=$PATH:/opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64’ >> ~/.bashrc
- Restart udev:
- sudo service udev restart
- Check that everything is ok:
- impack If you gave write access to your device ports as stated before in this post, you should not get any errors.
Now your Ubuntu machine is set up and ready.
This is the moment to clone this VM and make a backup. It might become handy in the future, specially if you start installing additional packages and libraries for your development, since it might create inconsistencies. Just talking out of experience here 🙂
#Work Flow
The workflow, one both VMs are set up is quite straightforward.
For generating bitstreams or the First Stage Boot Loader (FSBL), the ISE Design Suite is needed. In this case, boot up your Windows machine and do the changes you want to the FSBL and build the project. The binary ($ZYNQ_TRD_HOME/sw/zynq_fsbl/Debug/zynq_fsbl.elf) will be generated.
Since the workspace is shared, then boot up you linux machine, copy the binary to the SD CARD and boot up from the board. Any other compiling task that does not require ISE Design Suite can be performed in the linux machine. Cross-Compiling tasks must be carried out here.
#ISE Design Suite License issues
In this section I will make some comments on the Xilinx licensing process. It is not remarkably complicated, but some times the license can lead to some confusion.
First, to use any software from the Xilinx SDK, you need a license. If you have purchased a board, a paper stating IMPORTANT contains a voucher number that can be used to produce a license file. This license can be used to get full access to the ISE Embedded and System Edition. These are the most complete editions (link). However, there are some ISE versions that can be used under evaluation licenses. For more information on how to get a license and which license you use, please visit www.xilinx.com/getlicense.
Please note, if you are following the TDR example (here), even with a full license for ISE System or Embedded Edition, you will not be able to generate the PFGA Hardware Bitstream. You will get an error related to the IPs v_tc, v_cresamp components. You need an extra license for implementing this IP cores. More information can be found in the following links:
- http://www.xilinx.com/support/documentation/ip_documentation/v_tc/v3_0/ds857_v_tc.pdf
- http://www.xilinx.com/support/documentation/ip_documentation/v_cresample/v1_0/pg012_v_cresample.pdf
#Conclusion
In this article we describe the different alternatives for setting up a working environment for the Xilinx Zynq-7000 SoC ZC702 Evaluation Kit. We comment on the advantages and disadvantages of each alternative, and we present our own approach, based on a combination of 2 Virtual Machines containing different parts of the Xilinx SDK. This approach leverages the benefits of having a linux developing environment, while it avoid the extra complexity of dealing with broken libraries and dependencies of part of the SDK that is not supported for certain linux distributions. By maintaining a workflow based on shared directories, the overhead of using two virtual machines is very little.
Enjoy! 🙂
#REFERENCES:
http://wiki.xilinx.com/zynq-base-trd-14-4#toc19
http://www.george-smart.co.uk/wiki/Xilinx_JTAG_Linux
http://git.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver?a=blob_plain;f=README;hb=HEAD
http://dreamrunner.org/blog/2012/09/12/install-xilinx-ise-on-the-ubuntu/
http://www.xilinx.com/products/design-tools/ise-design-suite/system-edition.htm