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.
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
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/
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
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'.
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.
C:\Xilinx\Tutorials\grmon-eval\win32> grmon-eval.exe -u grlib> info sys
C:\Xilinx\Tutorials\grmon-eval\win32> grmon-eval.exe nb -u grlib> load image-2.0.x.dsu grlib> run
C:\Xilinx\Tutorials\grmon-eval\win32>grmon-eval.exe -u GRMON LEON debug monitor v1.1.37 evaluation version Copyright (C) 2004-2008 Aeroflex Gaisler - all rights reserved. For latest updates, go to http://www.gaisler.com/ Comments or bug-reports to support@gaisler.com This evaluation version will expire on 28/6/2010 try open device //./com1 ###opened device //./com1 Device ID: : 0x505 GRLIB build version: 3848 initialising ................... detected frequency: 80 MHz Component Vendor LEON3 SPARC V8 Processor Gaisler Research AHB Debug UART Gaisler Research AHB Debug JTAG TAP Gaisler Research SVGA frame buffer Gaisler Research GR Ethernet MAC Gaisler Research DDR2 Controller Gaisler Research AHB/APB Bridge Gaisler Research LEON3 Debug Support Unit Gaisler Research LEON2 Memory Controller European Space Agency System ACE I/F Controller Gaisler Research Generic APB UART Gaisler Research Multi-processor Interrupt Ctrl Gaisler Research Modular Timer Unit Gaisler Research PS/2 interface Gaisler Research PS/2 interface Gaisler Research General purpose I/O port Gaisler Research AMBA Wrapper for OC I2C-master Gaisler Research AMBA Wrapper for OC I2C-master Gaisler Research AHB status register Gaisler Research Use command 'info sys' to print a detailed report of attached cores grlib> info sys 00.01:003 Gaisler Research LEON3 SPARC V8 Processor (ver 0x0) ahb master 0 01.01:007 Gaisler Research AHB Debug UART (ver 0x0) ahb master 1 apb: 80000700 - 80000800 baud rate 115200, ahb frequency 80.00 02.01:01c Gaisler Research AHB Debug JTAG TAP (ver 0x0) ahb master 2 03.01:063 Gaisler Research SVGA frame buffer (ver 0x0) ahb master 3 apb: 80000600 - 80000700 clk0: 25.00 MHz clk1: 25.00 MHz clk2: 40.00 MHz clk3: 65.00 MHz 04.01:01d Gaisler Research GR Ethernet MAC (ver 0x0) ahb master 4, irq 12 apb: 80000b00 - 80000c00 edcl ip 192.168.0.52, buffer 2 kbyte 00.01:02e Gaisler Research DDR2 Controller (ver 0x0) ahb: 40000000 - 60000000 ahb: fff00100 - fff00200 64-bit DDR2 : 1 * 256 Mbyte @ 0x40000000 190 MHz, col 10, ref 7.8 us, trfc 131 ns 01.01:006 Gaisler Research AHB/APB Bridge (ver 0x0) ahb: 80000000 - 80100000 02.01:004 Gaisler Research LEON3 Debug Support Unit (ver 0x1) ahb: 90000000 - a0000000 AHB trace 128 lines, stack pointer 0x4ffffff0 CPU#0 win 8, hwbp 2, itrace 128, srmmu, lddel 1 icache 2 * 8 kbyte, 32 byte/line lru dcache 1 * 8 kbyte, 16 byte/line 03.04:00f European Space Agency LEON2 Memory Controller (ver 0x1) ahb: 00000000 - 20000000 ahb: 20000000 - 40000000 ahb: c0000000 - c2000000 apb: 80000000 - 80000100 16-bit prom @ 0x00000000 04.01:067 Gaisler Research System ACE I/F Controller (ver 0x0) irq 13 ahb: fff00200 - fff00300 01.01:00c Gaisler Research Generic APB UART (ver 0x1) irq 2 apb: 80000100 - 80000200 baud rate 38461, DSU mode (FIFO debug) 02.01:00d Gaisler Research Multi-processor Interrupt Ctrl (ver 0x3) apb: 80000200 - 80000300 03.01:011 Gaisler Research Modular Timer Unit (ver 0x0) irq 8 apb: 80000300 - 80000400 8-bit scaler, 2 * 32-bit timers, divisor 80 04.01:060 Gaisler Research PS/2 interface (ver 0x2) irq 4 apb: 80000400 - 80000500 05.01:060 Gaisler Research PS/2 interface (ver 0x2) irq 5 apb: 80000500 - 80000600 08.01:01a Gaisler Research General purpose I/O port (ver 0x0) apb: 80000800 - 80000900 09.01:028 Gaisler Research AMBA Wrapper for OC I2C-master (ver 0x1) irq 14 apb: 80000900 - 80000a00 Controller index for use in GRMON: 1 0c.01:028 Gaisler Research AMBA Wrapper for OC I2C-master (ver 0x1) irq 11 apb: 80000c00 - 80000d00 Controller index for use in GRMON: 2 0f.01:052 Gaisler Research AHB status register (ver 0x0) irq 7 apb: 80000f00 - 80001000 grlib> quit C:\Xilinx\Tutorials\grmon-eval\win32>grmon-eval.exe nb -u GRMON LEON debug monitor v1.1.37 evaluation version Copyright (C) 2004-2008 Aeroflex Gaisler - all rights reserved. For latest updates, go to http://www.gaisler.com/ Comments or bug-reports to support@gaisler.com This evaluation version will expire on 28/6/2010 try open device //./com1 ###opened device //./com1 Device ID: : 0x505 GRLIB build version: 3848 initialising ................... detected frequency: 80 MHz Component Vendor LEON3 SPARC V8 Processor Gaisler Research AHB Debug UART Gaisler Research AHB Debug JTAG TAP Gaisler Research SVGA frame buffer Gaisler Research GR Ethernet MAC Gaisler Research DDR2 Controller Gaisler Research AHB/APB Bridge Gaisler Research LEON3 Debug Support Unit Gaisler Research LEON2 Memory Controller European Space Agency System ACE I/F Controller Gaisler Research Generic APB UART Gaisler Research Multi-processor Interrupt Ctrl Gaisler Research Modular Timer Unit Gaisler Research PS/2 interface Gaisler Research PS/2 interface Gaisler Research General purpose I/O port Gaisler Research AMBA Wrapper for OC I2C-master Gaisler Research AMBA Wrapper for OC I2C-master Gaisler Research AHB status register Gaisler Research Use command 'info sys' to print a detailed report of attached cores grlib> load image-2.0.x.dsu section: .stage1 at 0x40000000, size 12288 bytes section: .rom at 0x40004000, size 451280 bytes section: .rdimage at 0x400722d0, size 815104 bytes section: .data at 0x401392d0, size 55540 bytes total size: 1334212 bytes (87.5 kbit/s) read 1201 symbols entry point: 0x40000000 grlib> run Reading AMBA Plug&Play configuration area Found apbmst, cfg: 0x800ff000 bootloader_supplied_stack: 4fffff88 � uClinux/Sparc Flat model support (C) 1998-2000 Kenneth Albanowski, D. Jeff Dionne LEON-2.1 Sparc V8 support (C) 2000 D. Jeff Dionne, Lineo Inc. LEON-2.2/LEON-2.3 Sparc V8 support (C) 2001 The LEOX team <team@leox.org>. KERNEL:TEXT=0x40004000-0x400722d0 DATA=0x401392d0-0x40146bc4 BSS=0x40146bd0-0x40 15f1a8 KERNEL -> ROMFS=0x400722d0-0x401392d0 MEM=0x4015f1b0-0x4fffef88 STACK=0x4fffef88 -0x4fffff88 VFS: open root device 1f:00 VFS: open root device 1f:00 start_mem is 0x4015f1b0 virtual_end is 0x4fffef88 before free_area_init free_area_init -> start_mem is 0x401621b0 virtual_end is 0x4fffef88 VFS: open root device 1f:00 (4015eb10) Calibrating delay loop.. ok - 39.93 BogoMIPS Mem_init: start=404a7000, end=4fffef88 Memory available: 257372k/260887k RAM, 0k/0k ROM (4764k kernel data, 440k code) Swansea University Computer Society NET3.035 for Linux 2.0 NET3: Unix domain sockets 0.13 for Linux NET3.035. Swansea University Computer Society TCP/IP for NET3.034 IP Protocols: ICMP, UDP, TCP uClinux version 2.0.39.uc2 (centos@localhost.localdomain) (gcc version 3.2.2) 13 Sat Nov 14 16:52:22 PST 2009 Init VFS: open root device 1f:00 Attaching grlib apbuart serial drivers: grlib apbuart serial driver get_baud_id: baud 17812 get_baud_id: e ttyS0 (irq = 2) is a builtin grlib apbuart, base: 0x80000100 Adjusting Adjusting at 400722d0, length = c6ed0 Blkmem copyright 1998,1999 D. Jeff Dionne Blkmem copyright 1998 Kenneth Albanowski Blkmem 1 disk images: 0: 400722D0-401392CF (RO) VFS: open root device 1f:00 VFS: Mounted root (romfs filesystem) readonly. Trying to open: /dev/ttyS0 Starting init init started: BusyBox v0.60.5 (2009.11.15-00:51+0000) multi-call binary Shell invoked to run file: /etc/init.d/rcS Command: #!/bin/sh Command: Command: echo "###Start..." ###Start... Command: hostname ethspw Command: #mount -t proc proc /proc Command: # Command: #expand /etc/ramfs.img /dev/ram0 Command: #mount -t ext2 /dev/ram0 /var Command: # Command: #mkdir /var/tmp Command: #mkdir /var/log Command: #mkdir /var/log/boa Command: #mkdir /var/dhcpc Command: #touch /var/resolv.conf Command: # Command: #/bin/dhcpcd Command: # Command: #/bin/boa -c /home/boa & Command: #/bin/ethspw & Command: # Command: # Command: #hostname leon2 Command: Command: mount -t proc proc /proc mount: /etc/mtab: Read-only file system Command: Command: mount -n -t devpts devpts /dev/pts mount: Mounting devpts on /dev/pts failed: No such device pid 9: failed 256 Command: Command: /sbin/ifconfig lo up 127.0.0.1 netmask 255.0.0.0 Command: /sbin/ifconfig eth0 up 192.168.0.80 SIOCGIFFLAGS: No such device SIOCSIFADDR: No such device pid 11: failed 512 Command: Command: route add 127.0.0.1 dev lo Command: route add default dev eth0 SIOCADDRT: No such device pid 13: failed 1792 Command: Command: route add default gw 192.168.0.1 dev eth0 SIOCADDRT: No such device pid 14: failed 1792 Command: Command: #/bin/testnet 9999 Command: Command: /bin/portmap -d & [15] Command: #mount -o nolock -o ro -t nfs 192.168.0.15:/home /home/nfs Command: Command: /bin/sh Sash command shell (version 1.1.1) /> ls bin dev usr etc sys var proc tmp home lib sbin mnt /> cd bin /bin> ls can1 ln route kill portmap usleep can3 rm mkdir sh can2 stty testnet ping more testsin inetd busybox rmdir httpd ls pwd getopt uname mount ps agetty tar /bin> cd No HOME environment variable /bin> cd .. /> pwd / /> exit Execution Finished, Exiting Please press Enter to activate this console.
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/>.