Difference between revisions of "MASC/uCLinux On LEON3"

From Vlsiwiki
Jump to: navigation, search
(Program ML505 with μCLinux and LEON3)
(Hardware)
 
(5 intermediate revisions by the same user not shown)
Line 9: Line 9:
  
 
=== Hardware ===
 
=== Hardware ===
* [http://www.xilinx.com/products/devkits/HW-V5-ML505-UNI-G.htm Xilinx Vertex 5, ML-505 board]
+
* [http://www.xilinx.com/products/devkits/HW-V5-ML505-UNI-G.htm Xilinx Virtex 5, ML-505 board]
 
* [http://www.xilinx.com/products/devkits/HW-USB-G.htm Xilinx Platform Cable USB]
 
* [http://www.xilinx.com/products/devkits/HW-USB-G.htm Xilinx Platform Cable USB]
 
* Host Computer. x86-64 machine (AMD Phenom x4 9950 Black (AMD64))
 
* Host Computer. x86-64 machine (AMD Phenom x4 9950 Black (AMD64))
Line 137: Line 137:
 
== Program ML505 with μCLinux and LEON3 ==
 
== 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 on XP. A good follow on project would be to program the board using CentOS.
+
Install Windows XP SP2 (32-bit) to a computer, install Xilinx ISE 11.1 Design Suite. 'Xilinx_11.1_ISE_DS_SFD.tar' can be downloaded from Xilinx. Disable 'Acquire or Manage a License Key' and disable 'Launch XilinxUpdate'. XP is used to program the board instead of CentOS due to time constraints, everything works without much trouble on XP. A good follow on project would be to program the board using 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.
+
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. Do not connect to Windows Update to find a driver, allow the driver to be installed automatically.
  
 
* Use Xilinx iMPACT to download the leon3mp.bit file to the FPGA.
 
* Use Xilinx iMPACT to download the leon3mp.bit file to the FPGA.
Line 223: Line 223:
 
<u>Micro Architecture Santa Cruz Group (MASC)</u>. 29 November 2009 <http://masc.soe.ucsc.edu/>.  
 
<u>Micro Architecture Santa Cruz Group (MASC)</u>. 29 November 2009 <http://masc.soe.ucsc.edu/>.  
  
<uMuthuswamy, Bharathwaj. <u>FPGA TOOLS-HOW TO</u>. Berkeley EECS, Spring 2007. <http://myweb.msoe.edu/~muthuswamy/pubs/FPGA-Tools_HOWTO.pdf>.
+
Muthuswamy, Bharathwaj. <u>FPGA TOOLS-HOW TO</u>. Berkeley EECS, Spring 2007. <http://myweb.msoe.edu/~muthuswamy/pubs/FPGA-Tools_HOWTO.pdf>.
  
 
<u>Publications</u>. 2009. 20 November 2009 <http://users.soe.ucsc.edu/~elkaim/elkaim/Publications.html>.  
 
<u>Publications</u>. 2009. 20 November 2009 <http://users.soe.ucsc.edu/~elkaim/elkaim/Publications.html>.  

Latest revision as of 20:49, 25 December 2009

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 Design Suite. 'Xilinx_11.1_ISE_DS_SFD.tar' can be downloaded from Xilinx. Disable 'Acquire or Manage a License Key' and disable 'Launch XilinxUpdate'. XP is used to program the board instead of CentOS due to time constraints, everything works without much trouble on XP. A good follow on project would be to program the board using 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. Do not connect to Windows Update to find a driver, allow the driver to be installed automatically.

  • Use Xilinx iMPACT to download the leon3mp.bit file to the FPGA.
  1. Start Xilinx iMPACT, automatically create and save a project->Yes. select 'Configure devices using Boundary-Scan(JTAG)'->OK.
  2. 'Do you want to continue and assign configuration file(s)?'->No. 'Device Programming Properties'->Cancel.
  3. On the xc5vlx50t chip, right click 'Assign New Configuration File'. Select the leon3mp.bit. 'Attach SPI or BPI PROM'->No.
  4. On the xc5vlx50t chip, right click 'Program'. 'Device Programming Properties'->OK.
  5. Xilinx iMPACT should report 'Program Succeeded'.
  • Download GRMON from Gaisler to debug and program the ML505 board.
  1. ftp://gaisler.com/gaisler.com/grmon/grmon-eval-1.1.37.tar.gz
  2. Extract to suitable directory.
C:\Xilinx\Tutorials\grmon-eval\win32> grmon-eval.exe -u
  grlib> info sys
  • Load the built image file to execute Linux on the FPGA
C:\Xilinx\Tutorials\grmon-eval\win32> grmon-eval.exe nb -u
  grlib> load image-2.0.x.dsu
  grlib> run

Follow On Work

  • Benchmarks. SPECint. Compile the core with/without the hardware FPU, and see how much worse SPECfp would be.
  • Troubleshoot the μCLinux Official Distribution. Fixing the 'paper cuts', as well as diff-ing the code between official and SnapGear. After fixing and gratuitous documentation, re-committing to the official site.
  • SystemACE. Using a CF card to combine the LEON3 bit file as well as the Linux image into a SystemACE file and install onto the CF card that came with the ML505.
  • Xilinx ISE Installation to CentOS. There are a myriad of tutorials and papers that touch on various parts of getting the ISE to work. Putting together a single source document with precise steps for Xilinx ISE installation would be useful.

References

Building and Loading U-boot On A Virtex Board. 29 November 2009 <http://xilinx.wikidot.com/u-boot#toc8>.

Casey Cain. Using and Creating Flash Files for the MicroBlaze Development Kit – Spartan-3E Edition. Gaisler Research, 1.0 edition, Nov 2006. <http://www.xilinx.com/support/documentation/application_notes/xapp963.pdf>.

CMPE 202. 29 November 2009 <http://www.soe.ucsc.edu/classes/cmpe202/Fall09/classwork.html>.

Daniel Hellström. SnapGear Linux for LEON. Gaisler Research, 1.37.0 edition, Nov 2008. <ftp://gaisler.com/gaisler.com/linux/linux-2.6/snapgear/snapgear-manual-1.0.37.pdf>.

EDK Concepts, Tools, and Techniques. Xilinx, 11.2 edition, Jun 2009. <http://www.xilinx.com/support/documentation/sw_manuals/xilinx11/edk_ctt.pdf>.

EEMBC--The Embedded Microprocessor Benchmark Consortium. 29 November 2009 <http://www.eembc.org/home.php>.

Embedded Linux/Microcontroller Project. 29 November 2009 <http://www.uCLinux.org/>.

Embedded Processor Block in Virtex-5 FPGAs. Xilinx, 1.7 edition, Oct 2009. <http://www.xilinx.com/support/documentation/user_guides/ug200.pdf>.

Embedded System Tools Reference Guide. Xilinx, 11.3.1 edition, Sep 2009. <http://www.xilinx.com/support/documentation/sw_manuals/xilinx11/est_rm.pdf>.

FPGA design from scratch. 29 November 2009 <http://svenand.blogdrive.com/archive/40.html>.

FPGA Developer: ML505 Tutorials and Examples. 29 November 2009 <http://www.fpgadeveloper.com/2008/10/ml505-tutorials-and-examples.html>.

GRMON User's Manual. Gaisler Research, 1.1.36 edition, Sept 2009. <http://www.gaisler.com/doc/grmon.pdf>.

GRLIB IP Core User's Manual. Gaisler Research, 1.0.21 edition, Aug 2009. <http://gaisler.com/products/grlib/grip.pdf>.

GRLIB IP Library. 29 November 2009 <http://www.gaisler.com/cms/index.php?option=com_content&task=section&id=13&Itemid=125>.

Jiri Gaisler, Marko Isomaki. LEON3 GR-XC3S-1500 Template Design. Gaisler Research, Oct 2006. <http://gaisler.com/doc/leon3-gr-xc3s-1500.pdf>.

Jiri Gaisler, Sandi Habinc, Edvin Catovic. GRLIB IP Library User's Manual. Gaisler Research, 1.0.21 edition, Aug 2009. <http://gaisler.com/products/grlib/grlib.pdf>.

LEON. 29 November 2009 <http://en.wikipedia.org/wiki/LEON>.

LEON3/GRLIB SOC IP Library. Gaisler Research,. <http://www.gaisler.com/doc/Leon3%20Grlib%20folder.pdf>.

LEON3MP. 29 November 2009 <http://www.gaisler.com/cms/index.php?option=com_content&task=view&id=167&Itemid=125>.

LEOX.org - Free Hardware and Software Resources for System on Chip. 29 November 2009 <http://www.leox.org/resources/sw.html>.

ML505/506/507 Overview and Setup. Xilinx, May 2009. <http://www.xilinx.com/products/boards/ml505/ml505_10.1_2/docs/ml505_overview_setup.pdf>.

ML505/ML506/ML507 Evaluation Platform. Xilinx, 3.1.1 edition, Oct 2009. <http://www.xilinx.com/support/documentation/boards_and_kits/ug347.pdf>.

ML505/ML506/ML507 Getting Started Tutorial. Xilinx, 3.0.3 edition, Jun 2009. <http://www.xilinx.com/support/documentation/boards_and_kits/ug348.pdf>.

ML505/ML506/ML507 Reference Design. Xilinx, 3.0.3 edition, Jun 2009. <http://www.xilinx.com/support/documentation/boards_and_kits/ug349.pdf>.

Micro Architecture Santa Cruz Group (MASC). 29 November 2009 <http://masc.soe.ucsc.edu/>.

Muthuswamy, Bharathwaj. FPGA TOOLS-HOW TO. Berkeley EECS, Spring 2007. <http://myweb.msoe.edu/~muthuswamy/pubs/FPGA-Tools_HOWTO.pdf>.

Publications. 2009. 20 November 2009 <http://users.soe.ucsc.edu/~elkaim/elkaim/Publications.html>.

Running Xilinx ISE and EDK 10.1 in Ubuntu 8.10. 29 November 2009 <http://www.aclevername.com/articles/linux-xilinx-tutorial/edk101-ubuntu810.html >.

SPEC-Standard Performance Evaluation Corporation. 29 November 2009 <http://www.spec.org/>.

Tutorials for Running Linux on Xilinx FPGAs. 29 November 2009 <http://www.aclevername.com/articles/linux-xilinx-tutorial/index.html>.

Virtex-5 Family Overview. Xilinx, 1.0 edition, Feb 2009. <http://www.xilinx.com/support/documentation/data_sheets/ds100.pdf>.

Virtex-5 FPGA Configuration User Guide. Xilinx, 3.8 edition, Aug 2009. <http://www.xilinx.com/support/documentation/user_guides/ug191.pdf>.

Virtex-5 FPGA User Guide. Xilinx, 5.2 edition, Nov 2009. <http://www.xilinx.com/support/documentation/user_guides/ug190.pdf>.

Virtex-5 FPGA Packaging and Pinout Specification. Xilinx, 4.6 edition, May 2009. <http://www.xilinx.com/support/documentation/user_guides/ug195.pdf>.

Virtualbox and the Xilinx USB Platform Cable. 29 November 2009 <http://peeters-noppe.net/alcaic/2009/09/virtualbox-and-the-xilinx-usb-platform-cable/>.

XILINX JTAG tools on Linux without proprietary kernel modules. 29 November 2009 <http://www.rmdir.de/~michael/xilinx/>.