MASC/uCLinux On LEON3

From Vlsiwiki
Revision as of 23:52, 24 December 2009 by Test (Talk | contribs) (Program ML505 with μCLinux and LEON3)

Jump to: navigation, search
UCLinuxLEON3.PNG

Introduction

MicroController Linux (μCLinux) is a Linux operating system for embedded hardware systems without a memory management unit (MMU).

The LEON3 is a 32-bit VHDL processor core based on the SPARCV8 RISC instruction set architecture.

This project will involve synthesis and placement of a LEON3 processor onto a commercial off the shelf (COTS) field programmable gate array (FPGA), μCLinux will then be loaded to the FPGA.

Hardware

People

  • Professor Jose Renau: Leader of the MASC group at UCSC, instructor for CMPE-202, Computer Architecture.
  • Samuel Toepke: PhD Student, primary investigator, student of Professor Renau.
  • Tom Golubev: Member of MASC group, MS student. Source of Xilinx tools, Xilinx ML505 board and Xilinx Platform Cable USB.
  • Rigo Dicochea: Member of MASC group, PhD student, general FPGA resource.
  • Javier Castillo: Member of MASC group, embedded Linux resource.

System

  • Ubuntu 8.10/9.10 running Sun VirtualBox Version 2.2.2 r46594/Version 3.1.2 r56127.
  • Virtual Machine running CentOS 5.3 i386, http://www.centos.org
  • Download:
    • CentOS-5.3-i386-bin-1of6.iso
    • CentOS-5.3-i386-bin-2of6.iso
    • CentOS-5.3-i386-bin-3of6.iso
    • CentOS-5.3-i386-bin-4of6.iso
  • Procedure:
  1. Obtain a desktop computer. Any desktop machine with a USB port, serial port, and internet connection should suffice. Install the host Operating System of Ubuntu 8.10, as well as the specified VirtualBox.
  2. Download the CentOS distribution, specific .iso files listed above.
  3. (VirtualBox is used here, however, CentOS could of course be used as the machine's primary operating system). In VirtualBox, create a new virtual machine. Specific options used are described in CentOS_5.3_i386.xml.
  4. With the new virtual machine, mount and boot to CentOS-5.3-i386-bin-1of6.iso.
  5. When installing CentOS, install the following extras: "Development Libraries","Development Tools","Java Development","Legacy Software Development".
  6. Login-name: 'centos' sans single quotes.
  7. Once CentOS is installed: a. Applications->System Tools->Software Updater
  8. We know have a fresh, updated operating system to begin the project.

Building uCLinux

Cross Compiler

The cross compiler is necessary to compile μCLinux using LEON3 as the target architecture.

In the CentOS virtual machine, open a terminal.

$ cd
$ pwd
/home/centos
$ mkdir uCLinux
$ cd uCLinux/
$ mkdir crosscompiler
$ cd crosscompiler/
$ wget ftp://gaisler.com/gaisler.com/linux/linux-2.0/toolchains/sparc-linux-3.2.2/sparc-linux-3.2.2-1.0.1.tar.bz2
$ tar xjf sparc-linux-3.2.2-1.0.1.tar.bz2 
$ su
Password: 
$root cp -R ./sparc-linux /opt
$root exit
exit
$ export PATH=$PATH:/opt/sparc-linux/bin

uCLinux Source

We're going to use an instance of uCLinux that is safely ensconced within SnapGear Linux provided by Gaisler. The mainline distribution of uCLinux is rife with 'paper cuts'.

$ cd
$ cd uCLinux
$ mkdir uCLinux_source
$ cd uCLinux_source
$ wget ftp://gaisler.com/gaisler.com/linux/linux-2.0/snapgear/snapgear-2.0-p36.tar.bz2
$ tar xjf snapgear-2.0-p36.tar.bz2
$ cd snapgear-2.0-p36
$ make xconfig
         Kernel/Library/Defaults Selection, Libc Version: uClibc, Customize Vendor/User Settings: Y,
         'Save and Exit'.
         Set Kernel Command Line: n
         boa 0.94.14rc21: n
         hdparm: n
         SnapGear Embedded Linux Application Configuration -> Network Applications, telnetd: n,
         'Save and Exit'.
$ make dep
$ make

Built images will be found at: /home/centos/uCLinux/uCLinux_source/snapgear-2.0-p36/images/

TSIM

Validate the built image by using a LEON3 emulator from Gaisler.

$ cd
$ cd uCLinux
$ mkdir TSIM
$ cd TSIM
$ wget ftp://ftp.gaisler.com/gaisler.com/tsim/tsim-eval-2.0.14.tar.gz
$ tar xfz tsim-eval-2.0.14.tar.gz
$ export PATH=$PATH:/home/centos/uCLinux/TSIM/tsim-eval/tsim/linux/
$ cd /home/centos/uCLinux/uCLinux_source/snapgear-2.0-p36/images/
$ tsim-leon3
$ tsim> load image-2.0.x.tsim
$ tsim> run

Building the LEON3

Download Xilinx ISE WebPACK. http://www.xilinx.com/tools/webpack.htm. Make an account and log in. The product you want is: "SW, ISE WebPACK 11.1 Single File Download Image" and the name of the file is "Xilinx_11.1_WebPack_SFD.tar".

$ cd
$ cd uCLinux
$ mkdir Xilinx_ISE_11
$ cd Xilinx_ISE_11
$ #Place the downloaded Xilinx_11.1_WebPack_SFD.tar into this directory.#
$ tar xf Xilinx_11.1_WebPack_SFD.tar
$ cd Xilinx_11.1_WebPack_SFD
$ su
Password: 
$root echo 0 >/selinux/enforce #to turn off secure linux
$root ./xsetup #Keep defaults, except: unselect 'Acquire or Manage a License Key', unselect 'Launch XilinxUpdate'.
$root chmod -R 755 /opt/Xilinx/11.1
$root exit
exit
$ cd /opt/Xilinx/11.1
$ ./settings32.sh
$ export PATH=$PATH:/opt/Xilinx/11.1/ISE/bin/lin

With the Xilinx account, request a 30 day trial license, or purchase a license. When the process is complete, you will have a file called 'Xilinx.lic'. Place the file in '/home/centos/.Xilinx/', chmod the permissions to 755.

Now that Xilinx ISE is installed, we'll pull down the LEON3 from Gaisler, and compile.

$ cd
$ cd uCLinux
$ mkdir LEON3
$ cd LEON3
$ wget http://www.gaisler.com/products/grlib/grlib-gpl-1.0.21-b3848.tar.gz
$ gzip -rd grlib-gpl-1.0.21-b3848.tar.gz
$ tar xf grlib-gpl-1.0.21-b3848.tar
$ cd grlib-gpl-1.0.21-b3848/designs/leon3-xilinx-ml505
$ make xconfig #Tested with enabling and disabling the MMU, both work. OK.
$ make ise-map
$ make ise #The resulting file is 'leon3mp.bit'.

Program ML505 with μCLinux and LEON3

Install Windows XP SP2 (32-bit) to a computer, install Xilinx ISE 11.1 webpack per before. XP is used to program the board instead of CentOS due to time constraints, everything works without much trouble. A good follow on project would be to program the board from CentOS.

Attach a serial cable from the ML505 to the XP machine. Connect the Xilinx Platform Cable USB from the XP host machine to the ML505. Attach the ML505 to a power source, and turn on.

Follow On Work

References