Last active
June 10, 2024 17:29
-
-
Save makestuff/7829484 to your computer and use it in GitHub Desktop.
Build FPGALink and the cksum VHDL example, and use flcli to write data to a Nexys2 board, and then read data back from it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------------------------------- | |
Building FPGALink & the cksum example VHDL for Digilent Nexys2 (1200K) on Linux: | |
# Install prerequisites: | |
sudo apt-get install build-essential libreadline-dev libusb-1.0-0-dev python-yaml | |
mkdir $HOME/20170708 | |
cd $HOME/20170708 | |
wget -qO- http://tiny.cc/msbil | tar zxf - | |
# Fetch and build flcli: | |
cd makestuff/apps | |
../scripts/msget.sh makestuff/flcli/20170708 | |
cd flcli | |
make deps | |
cd ../../ | |
# Fetch and build the VHDL version of the cksum example: | |
scripts/msget.sh makestuff/hdlmake | |
cd hdlmake/apps | |
../bin/hdlmake.py -g makestuff/swled | |
cd makestuff/swled/cksum/vhdl | |
../../../../../bin/hdlmake.py -t ../../templates/fx2all/vhdl -b nexys2-1200 -p fpga | |
# Load FPGALink firmware into the Nexys2 & enable USB power: | |
../../../../../../apps/flcli/lin.x64/rel/flcli -v 1d50:602b:0002 -i 1443:0005 -d D7 | |
# Program the FPGA: | |
../../../../../../apps/flcli/lin.x64/rel/flcli -v 1d50:602b:0002 -p J:D0D2D3D4:fpga.xsvf | |
# Write 64KiB of random data to the board: | |
dd if=/dev/urandom of=random.dat bs=1024 count=64 | |
../../../../../../apps/flcli/lin.x64/rel/flcli -v 1d50:602b:0002 -a 'w0 "random.dat";r1;r2' -b | |
# And now read 64KiB (0x10000 bytes) back from the board and save it as "out.dat": | |
../../../../../../apps/flcli/lin.x64/rel/flcli -v 1d50:602b:0002 -a 'r0 10000 "out.dat"' | |
--------------------------------------------------------------------------------------------------- | |
Alternatively, on Windows: | |
1) Install the Windows SDK: | |
http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/winsdk_web.exe | |
2) For x86, install this (choose "install just for me"): | |
http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi | |
Alternatively for x64, install this (choose "install just for me"): | |
http://www.python.org/ftp/python/2.7.6/python-2.7.6.amd64.msi | |
3) Install: | |
http://pyyaml.org/download/pyyaml/PyYAML-3.10.win32-py2.7.exe | |
4) Download this and uncompress it to C:\makestuff: | |
http://tiny.cc/msbiw | |
5) Run C:\makestuff\setup.exe, select the C/C compiler, Xilinx ISE and Python 2.7 and click | |
"Create Shortcut". | |
6) Launch the new desktop shortcut & continue at the shell-prompt (hint: you can paste into the | |
console window using the right mouse button). | |
# Connect the Nexys2 & use Zadig to replace the Digilent driver with a new WinUSB driver: | |
zadig.sh | |
# Fetch and build flcli: | |
cd $HOME/apps | |
msget.sh makestuff/flcli/20170708 | |
cd flcli | |
make deps | |
cd ../../ | |
# Fetch and build the VHDL version of the cksum example: | |
msget.sh makestuff/hdlmake | |
cd hdlmake/apps | |
../bin/hdlmake.py -g makestuff/swled | |
cd makestuff/swled/cksum/vhdl | |
../../../../../bin/hdlmake.py -t ../../templates/fx2all/vhdl -b nexys2-1200 -p fpga | |
# Load FPGALink firmware into the Nexys2 (you can press Ctrl-C after Windows detects the new device): | |
../../../../../../apps/flcli/msvc.x64/rel/flcli -v 1d50:602b:0002 -i 1443:0005 # x64 | |
../../../../../../apps/flcli/msvc.x86/rel/flcli -v 1d50:602b:0002 -i 1443:0005 # x86 | |
# Run Zadig again & install a new WinUSB driver for the newly-added FPGALink device (1D50:602B): | |
zadig.sh | |
# Enable USB power and program the FPGA: | |
../../../../../../apps/flcli/msvc.x64/rel/flcli -v 1d50:602b:0002 -d D7 -p J:D0D2D3D4:fpga.xsvf # x64 | |
../../../../../../apps/flcli/msvc.x86/rel/flcli -v 1d50:602b:0002 -d D7 -p J:D0D2D3D4:fpga.xsvf # x86 | |
# Write 64KiB of random data to the board: | |
dd if=/dev/urandom of=random.dat bs=1024 count=64 | |
../../../../../../apps/flcli/msvc.x64/rel/flcli -v 1d50:602b:0002 -a 'w0 "random.dat";r1;r2' # x64 | |
../../../../../../apps/flcli/msvc.x86/rel/flcli -v 1d50:602b:0002 -a 'w0 "random.dat";r1;r2' # x86 | |
# And now read 64KiB (0x10000 bytes) back from the board and save it as "out.dat": | |
../../../../../../apps/flcli/msvc.x64/rel/flcli -v 1d50:602b:0002 -a 'r0 10000 "out.dat"' # x64 | |
../../../../../../apps/flcli/msvc.x86/rel/flcli -v 1d50:602b:0002 -a 'r0 10000 "out.dat"' # x86 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is much less useful when the http://tiny.cc/msbil link is now broken. I really like libfpgalink but it becomes very difficult over time to rebuild it with the dependency system that requires me to download a package from a target that has moved at least twice.