Difference between revisions of "FPGA Boot"

From Vlsiwiki
Jump to: navigation, search
(Install TILO)
(Finished synthesis instructions)
Line 1: Line 1:
 
With the eventual goal of booting uCLinux on SCOORE, the work is currently focusing on booting uCLinux on OpenSPARC T1. This project can be nicely divided into several high-level steps:
 
With the eventual goal of booting uCLinux on SCOORE, the work is currently focusing on booting uCLinux on OpenSPARC T1. This project can be nicely divided into several high-level steps:
  
Setup SPARC Development Environment
+
* Synthesize T1 core
Install TILO
+
* Place and route design
Compile the uClinux Kernel
+
* Operating system & software
Compile uClibc
+
* Load onto board
Build an initial ramdisk
+
Combine into bootable image with TILO
+
Create FPGA image and boot
+
  
== Development Environment ==
+
This project entailed the exploration of each of these sections, but is currently incomplete. We were never able to get the Xilinx EDK to place and route OpenSPARC T1 1.6 and ran out of time.
 +
 
 +
== Synthesize T1 Core ==
 +
 
 +
The first step is downloading the T1 core which can be done [http://www.opensparc.net/opensparc-t1/download.html here] (registration required). Simply unzip it, setup environment variables, and synthesize.
 +
 
 +
=== Prerequisites ===
 +
 
 +
A 32-bit installation of Linux is the easiest, as there're some issues with 64-bit Linux and one of the programs, though you can get it to work. Any distro, in our case Centos 5, should work. Custom software such as synplicity_pro, synplify, VCS, or VERA may be needed depending on if you're doing testing or synthesis.
 +
 
 +
=== Environment Variables ===
 +
 
 +
I used Bash for this project, and the bash script provided is actually tcsh. This script should be run on login or before doing synthesis. After converting it and deciding what I needed I ended up with the following:
 +
 
 +
<pre>export DV_ROOT="~/OpenSPARC_T1";
 +
export MODEL_DIR="~/OpenSPARC_T1_model";
 +
export CC_BIN="/usr/bin";
 +
export SYNP_HOME="${SOFT}/synplicity/fpga";
 +
export PATH=".:$DV_ROOT/tools/bin:$CC_BIN/:$PATH";
 +
export ENVDIR="$DV_ROOT/tools/env";
 +
 
 +
export TRE_ENTRY="/";
 +
export TRE_LOG="nobody";
 +
export TRE_SEARCH="$ENVDIR/tools.iver";
 +
 
 +
export PERL_MODULE_BASE="$DV_ROOT/tools/perlmod";
 +
export PERL_CMD="/usr/bin/perl";
 +
export VERA_HOME=""
 +
 
 +
# Important for VCS to not throw a warning
 +
export VCS_ARCH_OVERRIDE="linux"
 +
 
 +
# Synthesis and simulation commands
 +
export SIMS="sims -vcs_build_args=-full64 -group=core1 -novera_run -novera_build -nosas";
 +
export SYN="rsynp -device=XC5VLX110 -all";
 +
</pre>
 +
 
 +
The last two aliases, SIMS and SYN, are for simulation of the core and synthesis respectively. They're for a system without SAS or VERA on 64-bit Linux compiling for the XC5VLX110 (university edition/ML509).
 +
 
 +
=== Running on 64-bit ===
 +
 
 +
64-bit Linux requires a little more customization than when using 32-bit.
 +
 
 +
Configure ''/tools/bin/syn_command'' to add a -64bit argument. The resulting line should look something like: ''dc_shell-t -64bit -f $DV_ROOT/design/sys/synopsys/script/run.scr > dc_shell.log''
 +
 
 +
The ''sims'' command should be passed a vcs_build_args argument of -full64. The code I'm using to run the regression suite for OpenSPARC is ''sims -vcs_build_args=-full64 -group=core1 -novera_run -novera_build''.
 +
 
 +
The ''configsrch'' tool within ''DV_ROOT/tools/Linux/x86_64'' failed out with an unhelpful error code. I believe ''mktools'' was run at some point and that helped, but in the end it was replaced with the following shell script (may only apply to the 1.6 T1 release):
 +
 
 +
<pre>
 +
#!/bin/bash
 +
case "$1" in
 +
  "sims" ) echo "1.262";;
 +
  "DiagList" ) echo "1.11";;
 +
  "OutputDirector" ) echo "1.01";;
 +
  "Sims" ) echo "1.12";;
 +
  "showargv" ) echo "1.01";;
 +
  "regreport" ) echo "1.73";;
 +
  "Regreport" ) echo "5.01";;
 +
  "BitFieldTie" ) echo "1.09";;
 +
  "Midas" ) echo "3.30";;
 +
  * ) echo "1.0";;
 +
esac
 +
</pre>
 +
 
 +
Further editing of some C/C++ files is required to get this running fully: (First two items from [http://forums.sun.com/thread.jspa?threadID=5300280 the Sun forums], last comment points 2 & 4)
 +
 
 +
# Files ''$DV_ROOT/tools/pli/iop/device.h'' and ''$DV_ROOT/tools/pli/iop/pcx.h'' have an extra qualification, namely ''void pcx::clean();'' in pcx.h needed to be changed to ''void clean();'' and a similar change needed to be made in device.h. I'm fairly certain that this won't break functionality with any older compilers and will help to fix it for newer ones.
 +
# ''$DV_ROOT/verif/env/iss/pli/common/c/CircularLinkedList.cc'' failed to compile because line 174 was ''head = null'' instead of ''head = NULL''.
 +
# Edited ''device.h:44'' and removed ''device::''
 +
 
 +
 
 +
=== Synthesis ===
 +
 
 +
There are a few synthesis configuration options available in $DV_ROOT/design/sys/synplicity/env.prj. The following options were used by us.
 +
 
 +
* FPGA_SYN - Resizes various megacells and arrays to line up better in FPGAs and removes all asyncronous logic.
 +
* FPGA_SYN_NO_SPU - Removes the Stream Processing Unit for cryptographic acceleration.
 +
* FPGA_SYN_8_TLB - Decreases the TLB from 64 to 16 entries. (FPGA_SYN_16_TLB also exists)
 +
* FPGA_SYN_1THREAD - Reduces the single core from 4-threads to 1-thread capabilities.
 +
 
 +
Synthesis of the Sparc core and extra modules such as the crossbar bus is done using either the ''rsyn'' or ''rsynp'' programs. In the Bash script above we created as alias for synthesis that is SYN, so to start synthesis we just ran that.
 +
 
 +
We were originally only interested in synthesis and never made it past that, so we ended up with EDIF netlists of several different components that can be found in ''DV_ROOT/design/sys/iop/MODULE/SOFTWARE/HARDWARE''. For example after running ''rsynp -device=XC5VLX110 sparc'' you will find the output in ''DV_ROOT/design/sys/iop/sparc/synplicity/XC5VLX110''. ''sparc.edf'' is the important file that is used with the EDK project.
 +
 
 +
== Software ==
  
 
uClinux development first starts with a Linux distribution running on top of a SPARC computer. Ubuntu 7.10 can be found here: [http://releases.ubuntu.com/7.10/]. The Sun server in the MASC lab is being setup precisely for this purpose.
 
uClinux development first starts with a Linux distribution running on top of a SPARC computer. Ubuntu 7.10 can be found here: [http://releases.ubuntu.com/7.10/]. The Sun server in the MASC lab is being setup precisely for this purpose.
Line 17: Line 99:
 
[http://silo.auxio.org/usingtilo.html|Using TILO]
 
[http://silo.auxio.org/usingtilo.html|Using TILO]
  
== Create FPGA ACE Image ==
+
=== Create FPGA ACE Image ===
 
open the xmd command shell and do something like this:
 
open the xmd command shell and do something like this:
 
''file:///C:/EDK/doc/usenglish/help/platform_studio/html/ps_c_dld_using_genace_script.htm''
 
''file:///C:/EDK/doc/usenglish/help/platform_studio/html/ps_c_dld_using_genace_script.htm''
Line 24: Line 106:
 
For information on memory map, see ''ccx-firmware\src\mbfw_config.h''.
 
For information on memory map, see ''ccx-firmware\src\mbfw_config.h''.
  
== Booting the FPGA ==
+
=== Booting the FPGA ===
  
 
* Load the appropriate .ACE file onto the CompactFlash card. The .ACE file for a full OpenSolaris boot can be found in ''$SPARC/design/sys/edk/ace/OpenSPARCT1_1_6_os_boot.ace''
 
* Load the appropriate .ACE file onto the CompactFlash card. The .ACE file for a full OpenSolaris boot can be found in ''$SPARC/design/sys/edk/ace/OpenSPARCT1_1_6_os_boot.ace''

Revision as of 20:03, 30 March 2009

With the eventual goal of booting uCLinux on SCOORE, the work is currently focusing on booting uCLinux on OpenSPARC T1. This project can be nicely divided into several high-level steps:

  • Synthesize T1 core
  • Place and route design
  • Operating system & software
  • Load onto board

This project entailed the exploration of each of these sections, but is currently incomplete. We were never able to get the Xilinx EDK to place and route OpenSPARC T1 1.6 and ran out of time.

Synthesize T1 Core

The first step is downloading the T1 core which can be done here (registration required). Simply unzip it, setup environment variables, and synthesize.

Prerequisites

A 32-bit installation of Linux is the easiest, as there're some issues with 64-bit Linux and one of the programs, though you can get it to work. Any distro, in our case Centos 5, should work. Custom software such as synplicity_pro, synplify, VCS, or VERA may be needed depending on if you're doing testing or synthesis.

Environment Variables

I used Bash for this project, and the bash script provided is actually tcsh. This script should be run on login or before doing synthesis. After converting it and deciding what I needed I ended up with the following:

export DV_ROOT="~/OpenSPARC_T1";
export MODEL_DIR="~/OpenSPARC_T1_model";
export CC_BIN="/usr/bin";
export SYNP_HOME="${SOFT}/synplicity/fpga";
export PATH=".:$DV_ROOT/tools/bin:$CC_BIN/:$PATH";
export ENVDIR="$DV_ROOT/tools/env";

export TRE_ENTRY="/";
export TRE_LOG="nobody";
export TRE_SEARCH="$ENVDIR/tools.iver";

export PERL_MODULE_BASE="$DV_ROOT/tools/perlmod";
export PERL_CMD="/usr/bin/perl";
export VERA_HOME=""

# Important for VCS to not throw a warning
export VCS_ARCH_OVERRIDE="linux"

# Synthesis and simulation commands
export SIMS="sims -vcs_build_args=-full64 -group=core1 -novera_run -novera_build -nosas";
export SYN="rsynp -device=XC5VLX110 -all";

The last two aliases, SIMS and SYN, are for simulation of the core and synthesis respectively. They're for a system without SAS or VERA on 64-bit Linux compiling for the XC5VLX110 (university edition/ML509).

Running on 64-bit

64-bit Linux requires a little more customization than when using 32-bit.

Configure /tools/bin/syn_command to add a -64bit argument. The resulting line should look something like: dc_shell-t -64bit -f $DV_ROOT/design/sys/synopsys/script/run.scr > dc_shell.log

The sims command should be passed a vcs_build_args argument of -full64. The code I'm using to run the regression suite for OpenSPARC is sims -vcs_build_args=-full64 -group=core1 -novera_run -novera_build.

The configsrch tool within DV_ROOT/tools/Linux/x86_64 failed out with an unhelpful error code. I believe mktools was run at some point and that helped, but in the end it was replaced with the following shell script (may only apply to the 1.6 T1 release):

#!/bin/bash
case "$1" in
  "sims" ) echo "1.262";;
  "DiagList" ) echo "1.11";;
  "OutputDirector" ) echo "1.01";;
  "Sims" ) echo "1.12";;
  "showargv" ) echo "1.01";;
  "regreport" ) echo "1.73";;
  "Regreport" ) echo "5.01";;
  "BitFieldTie" ) echo "1.09";;
  "Midas" ) echo "3.30";;
  * ) echo "1.0";;
esac

Further editing of some C/C++ files is required to get this running fully: (First two items from the Sun forums, last comment points 2 & 4)

  1. Files $DV_ROOT/tools/pli/iop/device.h and $DV_ROOT/tools/pli/iop/pcx.h have an extra qualification, namely void pcx::clean(); in pcx.h needed to be changed to void clean(); and a similar change needed to be made in device.h. I'm fairly certain that this won't break functionality with any older compilers and will help to fix it for newer ones.
  2. $DV_ROOT/verif/env/iss/pli/common/c/CircularLinkedList.cc failed to compile because line 174 was head = null instead of head = NULL.
  3. Edited device.h:44 and removed device::


Synthesis

There are a few synthesis configuration options available in $DV_ROOT/design/sys/synplicity/env.prj. The following options were used by us.

  • FPGA_SYN - Resizes various megacells and arrays to line up better in FPGAs and removes all asyncronous logic.
  • FPGA_SYN_NO_SPU - Removes the Stream Processing Unit for cryptographic acceleration.
  • FPGA_SYN_8_TLB - Decreases the TLB from 64 to 16 entries. (FPGA_SYN_16_TLB also exists)
  • FPGA_SYN_1THREAD - Reduces the single core from 4-threads to 1-thread capabilities.

Synthesis of the Sparc core and extra modules such as the crossbar bus is done using either the rsyn or rsynp programs. In the Bash script above we created as alias for synthesis that is SYN, so to start synthesis we just ran that.

We were originally only interested in synthesis and never made it past that, so we ended up with EDIF netlists of several different components that can be found in DV_ROOT/design/sys/iop/MODULE/SOFTWARE/HARDWARE. For example after running rsynp -device=XC5VLX110 sparc you will find the output in DV_ROOT/design/sys/iop/sparc/synplicity/XC5VLX110. sparc.edf is the important file that is used with the EDK project.

Software

uClinux development first starts with a Linux distribution running on top of a SPARC computer. Ubuntu 7.10 can be found here: [1]. The Sun server in the MASC lab is being setup precisely for this purpose.

Install TILO

TILO

Create FPGA ACE Image

open the xmd command shell and do something like this: file:///C:/EDK/doc/usenglish/help/platform_studio/html/ps_c_dld_using_genace_script.htm Info can be found here: [the GenAce Script]

For information on memory map, see ccx-firmware\src\mbfw_config.h.

Booting the FPGA

  • Load the appropriate .ACE file onto the CompactFlash card. The .ACE file for a full OpenSolaris boot can be found in $SPARC/design/sys/edk/ace/OpenSPARCT1_1_6_os_boot.ace
  • The ML505 board boots from one of the folders on the CompactFlash card under the config directory. Pick a folder rev[0-7] and set the CFG[2:0] bits of SW3 to the binary value of the chosen folder. Be sure that there is only one .ACE file per directory.
  • Currently, rev0 contains the 'Hello World' image, while rev1 contains the full OpenSolaris boot image.
  • Attach a serial cable to the computer and connect to the serial connection using 9600 baud, 8N1, no-parity. Putty's default options work fine.
  • When the board is powered up, it will eventually prompt you with {OK}. at this point you can choose one of a couple boot options: boot -mverbose: 60 minute boot up time, initializes all services, including telnet and networking or boot -m milestone=none: faster boot, no services

References

Project to boot Ubuntu on OpenSPARC

on FPGA Project Site