Thesis documents

Many people had contact me asking for references about my thesis and decide to post them online so any one could take a look at the work I did last year, hope this helps to every one interested; The general goal was:

Hardware/software co-design approach for re-configurable architectures based on the Xilinx ML507 PowerPC 440 platform.
This thesis aims to find a reliable solution for bringing the Linux operating system on embedded devices, focusing on Xilinx re-configurable architectures as a base platform.

I will continue to maintain Yoctoproject Xilinx meta layer [1] as soon I get some free time, hope in the next week’s I will publish some patch’s, I’m going to set a personal goal, meta-xilinx should get official BSP layer by Yoctoproject release 1.2 target for April 2012.

For now thesis is located here [alligator-os]
and presentation at [alligator-
os_17012011
].

Advertisements

Xilinx 11.4 on Fedora 12; Playing with Spartan 3e starter kit

A few months ago I was at the Mexico city airport waiting for my flight departure and to kill time I went to look at magazines shop and found a Linux Journal with an article that cough my eye “Bere-Metal hacks with fpga programming” Marco Fioretti
article describes some FPGA basics covering Xilinx design tools, so I give a try to use Xilinx suite using an target platform a Spartan3e starter kit.
Xilinx suite does a better job than Altera Quartus software, installation is simpler not to mention that far less workarounds to get the environment setup and running; I found Gorge’s wiki a well document procedure to install Xilinx tools plus installing an alternative Jtag driver. The next steps are a simplification to get everything working under Fedora 12.
1. Get Xilinx suite.
Go to http://www.xilinx.com/support/download/index.htm and get the full DVD suite or the Web installer client as you prefer; I downloaded the full suite `Xilinx_11.1_ISE_DS_SFD.tar`
2. Untar
tar xf Xilinx_11.1_ISE_DS_SFD.tar
3. Run the installer script
./xsetup
4. Install Jtag driver
Install dependencies
sudo yum -y install fxload libusb-devel
Get source code for alternative usb-driver
git clone git://git.zerfleddert.de/usb-driver
Build the driver
cd usb-driver
make
Copy the driver to a place that Xilinx tools can find it.
cp libusb-driver.so /opt/Xilinx/11.1/common/lib/lin64/
Copy udev rules and Jtag firmaware
cd /opt/Xilinx/11.1/common/bin/lin64/install_script/install_drivers/linux_drivers/pcusb/
sudo cp xusbdfwu.rules /etc/udev/rules.d/
sudo cp *.hex /usr/share/
Reload udev rules *Only needed the first time
sudo udevadm control –reload-rules
5. Create a setup-xlnx script and add the next lines
#!/bin/sh
# Xilinx Webpack 11.1
XILINX_BASE=”/opt/Xilinx”
XILINX_VERSION=”11.1″
DISPLAY=:0
source ${XILINX_BASE}/${XILINX_VERSION}/settings64.sh
source ${XILINX_BASE}/${XILINX_VERSION}/ISE/settings64.sh
source ${XILINX_BASE}/${XILINX_VERSION}/EDK/settings64.sh
# No need to preload usb library if you installed in a location
# where xlnx tools can find it
#export XIL_IMPACT_USE_LIBUSB=0
#export LD_PRELOAD=/usr/local/lib/libusb-driver.so
# Optional Xilinx license definitions, if you have access to them
#export XILINXD_LICENSE_FILE=”2100@pcdesign;X:\licenses\Xilinx.lic”
#export LM_LICENSE_FILE=”2100@pcdesign;X:\licenses\Xilinx.lic”
6. Open a terminal and source the setup-xlnx script
source setup-xlnx
7. Optionally run the xilinxupdate utility to get latest updates
xilinxupdate
8. Start playing with Xilinx tools
ise – hdl design
xps – system integration
xps_sdk – software development environment
impact – programming tool
9. Programming the FPGA
Once a you complete an hdl design you need to generate a bitstream file to program the FPGA the tools also crates a script that can be used to automate the programing process just run
impact -batch <project-path>/etc/download.cmd
10. Continue learning
I have found in youtube several tutorial for hdl design using Xilinx tools even complete courses thanks to several Indian institutes of Technology

Altera Quartus 2 on Fedora 11

On the past months I was enrolled in a “Hardware Description Languages” course where we work with FPGAs implementing several hardware designs, the class cover VHDL and Verilog and I feel quite comfortable working with Verilog. As target platform I use an Altera DE2 devboard and Quartus II IDE;

Installing Quartus II is quite trivial on Fedora 11

1. Install tcsh shell

su -c “yum install tcsh”

2. From www.altera.com/download

Download Quartus II web-install script

3. Give executable permissions to the script

chmod +x 90_altera_webinstall.sh

4. Install dependencies for the installer script (Only for 64 bit systems)

su -c “yum install glibc.i586 glibc-devel.i586”

su -c “yum install libSM.i586 libzip.i586 libXi.i586 libXrender.i586 libXrandr.i586”

su -c “yum install freetype.i586 fontconfig.i586”

5. Run the Quartus II web-install script

./90_altera_webinstall.sh

Follow the installer

altera-webinstall

altera-webinstall-02

altera-webinstall-03

6. Edit ~/.bashrc file and add the path for “quartus/bin”

export PATH=$PATH:/<quartus-install-dir>/quartus/bin

7. Open a new terminal and launch Quartus II IDE

quartus –64bit

With the previous steps you have Quartus II installed, you can now create your own design and simulate them, for downloading your designs to the FPGA you will need a helper script that will start/stop the jtag demon and to create a udev rule file to allow all user to access the usb-blaster device.

On DE2 development platform usb-blaster is used to interface the Jtag server and the FPGA. I have found some references about using usb-blaster in Linux by adding udev rules to properly handle the usb programmer.

8. Create a udev rules file at /etc/udev/rules.d/ such as 30-usb-blaster.rules

Add the following lines

# Altera DE2 USB blaster udev rules
# Adrian Alonso <aalonso00@gmail.com>
#
SUBSYSTEM==”usb”,SYSFS{idVendor}==”09fb”,SYSFS{idProduct}==”6001″,MODE=”0666″,SYMLINK+=”usb-blaster”

Basically when the Usb-blaster is connected to the computer, the udev rules are triggered and based on the idVendor and idProduct values a dev node is created /dev/usb-blaster whit the permissions for Read/Write for every user.

Reload udev rules

su -c “udevcontrol –reload_rules”

*Note: This is only necessary the first time to enable the new rules.

9. Copy the next script and place the script at /<quartus-install-dir>/quartus/bin/
*Note: Change the JTAGD variable for the correct path.
————————————————————————————————–
#!/bin/bash
# Jtag server for usb-blaster
# Based on Dalon Jtagd script
# Reference: http://forum.niosforum.com/forum/index.php?showtopic=5486
# Adrian Alonso <aalonso00@gmail.com>
# Fix stop demon

# Source functions library
source /etc/rc.d/init.d/functions

RET=0
PROG=”jtagd”
PID_FILE=/var/run/jtagd.pid
JTAGD=/opt/altera9.0/quartus/bin/jtagd

start ()
{
echo -n $”Starting $PROG sever:”
$JTAGD && success || failure
RET=$?
pidofproc $PROG >> $PID_FILE
echo
}

stop ()
{
local pid
pidfileofproc $JTAG >> pid
if [ -n $pid]; then
echo -n $”Stopping $PROG server”
killproc $JTAGD
else
failure $”Stooping $PROG”
fi
echo
}

case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $”Usage: $0 {start|stop|restart}”
RET=1
esac

exit $RET
————————————————————————————————–

10. Start the Jtag server by

<script-name.sh> start

11. Create a jtag config file

touch /home/<user>/.jtag.conf

Yes, the file is empty, when launching the programmer from Quartus IDE it only checks if this file exits.

12. From Quartus II launch the programmer and select the device “usb-blaster” to be able to download your design.

programmer

13. SOPC builder fix

When I try to start the SOPC builder I just saw an splash screen and nothing happened, looking at the run time log files “sopc_builder_log.txt” (is placed on your main project directory), libXtst library is missing so just installing it will solve the problem.

su -c “yum install libXtst.i586”

spoc_builder

14. Working with NIOS IDE

Install dependency libraries

su -c “yum install gtk2.i586 libcanberra-gtk2.i586”

Create a script named nios2.sh and add the following lines (Make the proper changes)
————————————————————————————————–
#!/bin/bash
# User specific aliases and functions
export QUARTUS_64BIT=1
QUARTUS_BASE=/opt/altera9.0
export QUARTUS_ROOTDIR=$QUARTUS_BASE/quartus
export SOPC_KIT_NIOS2=$QUARTUS_BASE/nios2eds
export SOPC_BUILDER_PATH=$QUARTUS_BASE/nios2eds
unset GCC_EXEC_PREFIX
export PERL5LIB=/usr/lib/perl5/5.10.0
bash –rcfile $QUARTUS_ROOTDIR/sopc_builder/bin/nios_bash
————————————————————————————————–
Running the script will set the shell with all the environment variables needed to use the nios2 ide.

Start nios2-ide from the shell

nios2-ide

nios2-ide

There should be  a better way to wrap around 64bit libraries and avoid to install 32bit libraries to work with Quartus II.