You are on page 1of 14

Outline of this document

Executive Summary - our best advice comes first. Getting started - what you must know before you begin. Install files and locations - which files you need, where you can install them, and where you must not install them. Stepwise instructions - how to install the software, command by command. Putty - while you're at it, you may as well install the terminal emulator for the second lab session. USB-Blaster installation - some hand-editing of configuration files is required before you can connect the DE2 board. Running the software - how to start the software you just installed. Setting up the license - Quartus requires a valid license for some tasks. The license only works within KTH. Starting the Nios II IDE - how to start the program you will use most of the time.

Executive summary
To perform this installation, you have to use the GNU/Linux command-line. You will use commands that require administrative privileges. If you are uncomfortable with this, get help at one of our Workshops. We used Ubuntu 10.04 LTS (64-bit), and also Ubuntu 10.04.1 LTS (32-bit). Other distributions and other versions may work differently, and you're on your own if you use something else. There are some quirks that we have worked around. Follow our instructions carefully to to avoid problems. The software will break if you use any path containing spaces, , or other special characters. All software packages must use the same installation path, preferably /opt/altera9.0. The Digital Components lab (IS1500 only) uses the Quartus program, which is license-locked to a certain range of IP (network) addresses. This means that you can't prepare the Digital Components lab at home, even if you install the software. The other labs use the Nios II IDE, which is not license-locked and can be used anywhere.

Getting started
Contact us at is1200@ict.kth.se for download links and license info. Don't download from other sources. All laboratory exercises have been tested with Ubuntu GNU/Linux verion 10.04 "Lucid Lynx" for 64-bit x86 processors (AMD64, EM64T, or x86_64). The machine used is a small laptop: an

Acer Aspire 1410 with a 1.3 GHz Celeron 743 processor and 2 Gbytes of memory. We made a clean install of Ubuntu 10.04 LTS 64-bit, not an upgrade. We have also performed limited testing using Ubuntu GNU/Linux verion 10.04.1 "Lucid Lynx" for 32-bit x86 processors (i686). Version 10.04.1 is a bugfix update of version 10.04. To the best of our knowledge, the software works well under version 10.04.1. We used Wubi, the Windows installer for Ubuntu, to install Ubuntu 10.04.1 LTS 32-bit. The machine used to do this was a business notebook: an HP Compaq 2510p with a 1.2 GHz Mobile Core 2 Duo U7600 processor and 2 Gbytes of memory, with Windows 7 Enterprise (64-bit) installed. If you use a different version of Ubuntu, you may find our old tutorial useful.

Install files and locations


You will install two packages. After installation, you need to set up some environment variables. You will also have to start the main program and modify the settings slightly. The installation requires administrative (root, a.k.a. super-user) privileges on your machine, and some experience with command-line shells. Altera's installers require tcsh to work. See below for instructions on how to install tcsh. You will need the following install packages: 1. Quartus II (logic design software). Download size: more than 3 Gbytes. 2. Nios II IDE (Integrated Development Environment for Nios II programs). Download size: more than 700 Mbytes. You will need a lot of disk space. Expect to use nearly 20 Gbytes temporarily during installation, and at least 9 Gbytes after finishing the installation. The 9 Gbytes used by the finished installation will be in /opt/altera9.0 and subdirectories (sub-folders) for version 9.0 of the software. The temporary files used during installation will be in some directory (folder) of your choice. In order not to break the scripts which do all the work, make sure that there are no spaces anywhere in the complete path to the temporary directory. You can use any location as long as there are no spaces in the path or file-name. All packages must have the same version. We recommend that all packages be version 9.0. Mixing versions will create unpredictable problems. The order of installation is important. You must install Quartus first.

We strongly recommend that you do not change the default install locations of any of the install packages. This will install all components in subdirectories of the path /opt/altera9.0.

Stepwise instructions
Hint! It's really easy to accidentally skip a step. Print this web-page on paper, so you can check off each step after performing it. In the following examples, "linux$" is the command-line prompt-string for a user without special privileges; "linux#" is the prompt-string for the administrator (super-user). Commands and other input that you have to type are in boldface. Section 1: preliminaries 1. Super-user privileges. You must have super-user (root) privileges for this installation. Open a Terminal window and use either "su" or "sudo" to gain super-user (root) privileges. Example for a typical Ubuntu system: linux$ sudo bash [sudo] password for linux: Note: when installation is finished, you will not need super-user (root) privileges to use the programs. 2. The Altera software is compiled for 32-bit systems. On a 64-bit system with a 64-bit version of Ubuntu, you must have the 32-bit compatibility libraries installed. To install these libraries, or to check that they already are installed, type "apt-get install ia32-libs". Answer "y" for "yes" (or "j" for "ja" on a Swedish-language system) when the apt-get utility asks if you want to continue installing ia32-libs. If the 32-bit libraries are already installed, you will see the following response: linux# apt-get install ia32-libs Reading package lists... Done Building dependency tree... Done ia32-libs is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. On a 32-bit system, you will see the following response: linux# apt-get install ia32-libs Reading package lists... Done Building dependency tree... Done E: Could'nt find package ia32-libs This is normal. A 32-bit system does not need the ia32-libs package. 3. Altera's installers require tcsh to work. The tcsh command-line interpreter (shell) is not part of the standard install in most GNU/Linux distributions. To check if you have tcsh, type "which tcsh" at the shell prompt. A reply such as /usr/bin/tcsh

4.

5.

6. 7.

indicates that tcsh is already installed on your system. Example: linux# which tcsh linux# In this example, tcsh was not installed: the which command could not find any command named tcsh. If you don't have tcsh, install it. On our test system, this is performed by the command "apt-get install tcsh". You must have your Internet connection up and working, or aptget will not be able to install anything. Example: linux# apt-get update linux# apt-get install tcsh The apt-get command will check which extra packages need to be downloaded and installed. It will ask your permission before going ahead. You must answer "y" (or "yes") to those questions, or apt-get will abort without installing anything on your system. If tcsh is already installed, the apt-get output will look like this: linux# apt-get install tcsh Reading package lists... Done Building dependency tree... Done tcsh is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. linux# Note 1: The apt-get command is in general safe to use. If you mistype something, the actions of apt-get are in general safe and reversible. However, procedures for recovery from misuse of apt-get will not be listed here. Note 2: Other systems may require other methods for installing new packages. These methods may or may not be safe and/or reversible. Create a temporary folder in which you can store up to 10 Gbytes while installing. Make sure the folder-name and the complete path are free from white-space characters. Underscore ("_") can be used instead. Example: linux# mkdir /tmp/altera_install linux# Download the package files and save them into the temporary folder. Contact us at is1200@ict.kth.se for download links. In your Terminal window, change directory to the temporary folder. Use "ls" to check the contents. Example: linux# cd /tmp/altera_install linux# ls 90_nios2eds_linux.tar 90_quartus_linux.tar linux# We will not use the Altera installer. If you have it, don't use it - it is not compatible with current Ubuntu versions.

Section 2: Installing Quartus

If you took a break after the previous section, become super-user and change your working directory to /tmp/altera_install to get back to where you were. 1. Use "tar xvf 90_quartus_linux.tar" to unpack the Quartus install files. Example: linux# tar xvf 90_quartus_linux.tar quartus/ip/alpha_blending_mixer.tgz quartus/ip/altcal_dpa_pll.tgz (long list of files) Note: if your disk space is very limited, you can delete the file 90_quartus_linux.tar after "tar xvf 90_quartus_linux.tar" has finished successfully. Warning: if you later have problems with your installation, you will have to download the file again. To delete the file, use the command: linux# rm 90_quartus_linux.tar 2. A directory called "quartus" is created as part of the unpacking. The file "install" in that directory is an executable csh script. Run this file, preferably by giving its complete path. Example: linux# /tmp/altera_install/quartus/install The install script will ask a few questions, listed below. 3. Press <Return> to continue normal installation or type <s> to select the components to install: Press the Enter key to accept the default choice and continue. 4. Type the full pathname of the directory where you want to install the Altera Design Suite 9.0 software. (default: /opt/altera9.0): Press the Enter key to accept the default choice and continue. Troubleshooting: if you see the message compare: Command not found - then perhaps you forgot to install ia32-libs before starting the Quartus installation? 5. Please read the end-user license agreements located on this media entitled 'license.txt' and 'ip_lic.txt' Press <Return> to continue... Press the Enter key to continue. 6. The installation takes a while. Grab a cup of coffee while you wait. Note: if your disk space is very limited, you can delete the folder /tmp/altera_install/quartus after Quartus is successfully installed. To delete the folder, use the following dangerous command which cannot be undone. Warning: typing errors in this command could in some cases wipe your entire hard drive, with no undo possible, leaving you with no operating system at all. linux# rm -rf /tmp/altera_install/quartus Section 3: Installing Nios II IDE If you took a break after the previous section, become super-user and change your working directory to /tmp/altera_install to get back to where you were.

1. Before proceeding, you must set the environment variable QUARTUS_ROOTDIR to the path of the Quartus II installation subdirectory: /opt/altera9.0/quartus You must do this correctly, or the software will not work after installation. Example: linux# export QUARTUS_ROOTDIR=/opt/altera9.0/quartus linux# Important: When installing, the path shown was /opt/altera9.0. The value of the QUARTUS_ROOTDIR environment variable must equal the path to the quartus subdirectory, /opt/altera9.0/quartus. 2. Use "tar xvf 90_nios2eds_linux.tar" to unpack the Nios II EDS install files. Example: linux# tar xvf 90_nios2eds_linux.tar nios2eds/docs.tgz nios2eds/examples.tgz (short list of files) 3. A directory called "nios2eds" is created as part of the unpacking. The file "install" in that directory is a script. That script is not compatible with the default interpreter in Ubuntu 10.04. To work around this, use the bash command to run this file. Example: linux# bash /tmp/altera_install/nios2eds/install Troubleshooting: if you see the message Syntax error: "(" unexpected (expecting "fi") then perhaps you forgot to type bash at the beginning? 4. The install script will ask a few questions, listed below. 5. Press <Return> to continue installation: Press the Enter key to continue. 6. Type the full pathname of the directory where you want to install the Nios II EDS software. (default: /opt/altera9.0): Press the Enter key to accept the default choice and continue. 7. Installing to: /opt/altera9.0/nios2eds To confirm and proceed, enter 'yes' yes You must answer "yes" to this question, and then press the Enter key. Troubleshooting: if you forget to type "yes", the installer will create the directory /opt/altera9.0/nios2eds and then exit. To recover from this mistake, you should remove the directory /opt/altera9.0/nios2eds and then re-execute the command "bash /tmp/altera_install/nios2eds/install". If you ever need to do this, type "sudo nautilus &" to start a super-user file-manager, then navigate to filesystem - opt - altera9.0 and remove the nios2eds directory. 8. The installation takes a few minutes. Section 4: Library changes - Xi and GDK If you took a break after the previous section, become super-user and change your working directory to /tmp/altera_install to get back to where you were.

1. You must use an older version of the library file libXi.so.6 for the Nios II IDE. There are two versions of this older library file: one for 32-bit systems, and another for 64-bit systems. Use the following command to check whether you have a 32-bit system or a 64bit system: linux# uname -a If the output ends with "x86_64 GNU/Linux", you have a 64-bit system; if the output ends with "i686 GNU/Linux", you have a 32-bit system. 2. Download only one of the following files. Select the one appropriate for your system use the 32-bit version for a 32-bit system, and the 64-bit version for a 64-bit system. Zipped archive containing libXi.so.6.0.0, 32-bit version Zipped archive containing libXi.so.6.0.0, 64-bit version Save the downloaded file to the /tmp/altera_install directory. Note: if the file manager shows a padlock symbol on the altera_install folder and refuses to let you copy files there, type the following command to change the permissions of the altera_install folder: linux# chmod o+rwx /tmp/altera_install 3. Unzip the downloaded file: linux# unzip libXi* 4. Create a directory for the library file: linux# mkdir /opt/altera9.0/lib 5. Copy the library file to the new directory: linux# cp libXi.so.6.0.0 /opt/altera9.0/lib 6. Create a soft link to the library file: linux# cd /opt/altera9.0/lib linux# ln -s libXi.so.6.0.0 libXi.so.6 7. Create a new startup-script file so that the correct library file is used for the Nios II IDE: linux# gedit /opt/altera9.0/nios2eds/user.bashrc In the editor window, type the following (2 lines): export LD_LIBRARY_PATH=/opt/altera9.0/lib:/usr/lib32:/lib32:/usr/l ib:/lib export GDK_NATIVE_WINDOWS=true Add a blank line at the end of the file. Press Ctrl-S to save, and then Ctrl-Q to exit gedit. If you prefer, you can download a finished user.bashrc file from us (as a zipped archive). Troubleshooting: If you installed the software to some non-standard location, the line with LD_LIBRARY_PATH must be changed to reflect this. The line with GDK_NATIVE_WINDOWS tells Nios II IDE to use old-style calls for the user-interface. If you have problems with buttons that don't react when you click them, or user-interface tabs that are blank when they shouldn't, then maybe you have some spelling error on this line. Section 5: USB-Blaster If you took a break after the previous section, become super-user to get back to where you were.

1. During the laboratory sessions, your computer will communicate with the USB-Blaster hardware on the DE2 board. To enable Quartus II 9.0 to communicate with the USBblaster, perform the following steps. 2. Edit /etc/rc.local to add support for usbfs: linux$ gedit /etc/rc.local In the editor window, add the following two lines before the line "exit 0": mount --bind /dev/bus /proc/bus ln -s /sys/kernel/debug/usb/devices /proc/bus/usb/devices Press Ctrl-S to save, and then Ctrl-Q to exit gedit. 3. To allow all users to access the USB-Blaster hardware, create a new file /etc/udev/rules.d/51-usbblaster.rules: linux$ gedit /etc/udev/rules.d/51-usbblaster.rules In the editor window, type the following two lines: # Altera USB-Blaster rule to set mode to 666. SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", SYSFS{idVendor}=="09fb", SYSFS{idProduct}=="6001", MODE="0666", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", RUN+="/bin/chmod 0666 %c" Please note that the text starting with SUBSYSTEM and ending with RUN+="/bin/chmod 0666 %c" is all on one long line. Press Ctrl-S to save, and then Ctrl-Q to exit gedit. If you prefer, you can download a finished 51-usbblaster.rules file from us (as a zipped archive). 4. You must reboot your system before connecting the USB-Blaster, since the system only reads the file /etc/rc.local during startup. Section 6: Terminal Emulator program For some laboratory exercises, you need a terminal-emulator program. We recommend putty for this, and putty can be installed with the command "sudo apt-get install putty": linux$ sudo apt-get install putty Section 7: Finishing the installation You can now delete the temporary directory /tmp/altera_install and all its contents. If you use your own laptop with Ubuntu, and only one user account for yourself, skip the following section on user privileges. The default values will work fine. On a Ubuntu system with several users, make sure that all users have the required privileges. In the Users and Groups setup applet, open the "Advanced settings" for each user that will use the Altera software and laboratory hardware. The

following two privileges must be enabled (check-boxes checked): Access external storage devices automatically, and Use modems You can of course enable other privileges for other purposes. These two are the minimum requirements for sucessfully running the Altera software and laboratory exercises. Troubleshooting: "Access external storage devices automatically" is required for the USBblaster. Without this privilege, the software will stall indefinitely when the user tries to download a configuration into the laboratory hardware. There will be no error message, things just stop. "Use modems" is required for access to the USB-to-serial converter used in some laboratory exercises. Without this privilege, there will be an error message when the user tries to access the USB serial port. Your computer may not have a serial port, and we supply the Aten UC-232A serial-to-USB converter for use at the laboratory sessions. The Linux kernel in Ubuntu 10.04 includes the driver for this hardware; no driver installation is necessary.

Running the software


The software can run without administrative privileges. A normal user account will work perfectly (if the privileges are correctly setup by your administrator, of course). Start a Terminal window logged in as a normal user. Try the default keyboard shortcut: Ctrl-AltT, or look for Terminal in the menus. Important: if you are running as the super-user, type exit before running the software. A super-user shell is indicated by a '#' at the end of the prompt string. linux# exit linux$ There are several environment-variables that must be correctly set, or the software will not work. To get all the variables right, start a Nios II SDK shell: linux$ /opt/altera9.0/nios2eds/sdk_shell [Nios II EDS]$ The prompt is changed to indicate that you are now working from a new shell. Exiting this shell (with the exit command ) will bring you back to your previous command-line environment. In the Nios II SDK shell, use the command quartus to start Quartus, or nios2-ide to start the Nios II IDE.

Troubleshooting: Some users report that quartus cannot start. In this case, the command [Nios II EDS]$ quartus returns the response Segmentation fault within a few seconds. One of our students has kindly provided a guide how to fix this (in Swedish).

Setting up the license


You must have your Internet connection up, and you must have an IP address belonging to KTH. Otherwise, Quartus will not work properly. The best way to get an IP address belonging to KTH is to be in a room at KTH, and then connect to one of the wireless networks "eduroam" or "KTHOPEN". If you are logged in as root, log out and log in as a normal user. You will not need administrative privileges to run the software. Start a Nios II SDK shell, and start Quartus from that shell: linux$ /opt/altera9.0/nios2eds/sdk_shell [Nios II EDS]$ quartus Setup the license using the license-string you received by e-mail from us, in the same e-mail message as the download links.

The first time you run Quartus, you will see this screen. Make sure that the radio button "Quartus II" is selected. Then click OK.

Quartus will ask your preferences for license setup. Select "specify the location of the license file".

On this screen, type in the license string you got from us. The string is in the same e-mail message as the download links. Then click OK. Note: it really isn't a file, it's just a string.

The first time you start Quartus, you may see an introduction screen. Check the box "Don't show this screen again", then click the Close mark in the upper right corner.

When you see the question "Do you want to create a new project now?", click "No". The license setup is now finished. Click "File", then "Exit" to exit Quartus II.

Note: On a Ubuntu system with several users, each user will have to go through this procedure the first time Quartus starts up.

Starting Nios II IDE


Log in as a normal user. You will not need administrative privileges to run the software. Start a Nios II SDK shell, then start the Nios II IDE from that shell. Before starting any Nios II laboratory exercises, go through our Nios II IDE First Project tutorial.

Frfattare: F Lundevall, tekniskt ansvarig: webmaster@imit.kth.se Denna sidas URL: http://www.ict.kth.se/courses/IS1200/2011/swsetup/linux.html

Code in ubuntu install blaster usb:


$ $ $ $ $ sudo mount --bind /dev/bus /proc/bus sudo ln -s /sys/kernel/debug/usb/devices /proc/bus/usb/devices sudo <quartus_directory>/bin/jtagd sudo <quartus_directory>/bin/jtagconfig <quartus_directory>/bin/quartus

You might also like