Connectal PCIe: Getting Started

by myronking in Circuits > Linux

4961 Views, 14 Favorites, 0 Comments

Connectal PCIe: Getting Started

vc707.jpg

Use the PCIe bus to connect an FPGA Board to an X86 host machine running Linux. Build and execute a Connectal project. This tutorial includes instructions on how to install the entire tool-chain locally. If you can't/don't want to do this, use the Connectal Build service as shown in the zedboard example.

Parts List

DSC00250.JPG

0. Build/Host machine running Ubuntu

1. Xilinx VC707 or KC705 Board

2. Power cable for FPGA board

3. USB to Micro-USB cable

4. 8-lane PCIE ribbon cable (optional)

Connect the Board to the Host Machine

DSC00257.JPG

If the form factor permits, plug the board directly into an open PCIE slot on the motherboard of your host machine. In these instructions we are using a 1u rack-mounted server, which requires the use of a PCIe ribbon cable.

Connect the Programming Cable

DSC00259.JPG

Connect the MICRO USB end of the cable to the Digilent USB JTAG surface-mounted programming module and the other end to a vacant USB port on the host machine

Connect the Power Cable

DSC00261.JPG

Connect the power cable to the board and plug the other end into a wall socket. Power on the host machine and the FPGA board.

Install Vivado

Skip this step If you are using the Connectal Build service.

Connectal currently supports version 2014.1

Install Bluespec

Skip this step If you are using the Connectal Build Service.

On some machines, the underlying Haskell runtime requires a specific version of libgmp. This dependency appears to be artificial and can easily be faked with the following command:

sudo ln -s /usr/lib/x86_64-linux-gnu/libgmp.so.10.1.3 /usr/lib/x86_64-linux-gnu/libgmp.so.3

Install Connectal

Even if you are using the Connectal Build Service, you must install the packages to program the device and execute your design. The following commands add the connectal repository and download/install the packages:

sudo apt-add-repository -y ppa:jamey-hicks/connectal
sudo apt-get update
sudo apt-get install connectal<br>

You will need to reboot the machine (for udev). If the portalmem driver is not loaded automatically, load it using modprobe

sudo modprobe portalmem

The installation script writes the Connectal source to /usr/share/connectal.

Compile and Run a Design

If you are using the Connectal Build Service, follow the examples here to build the design (be sure to use https://github.com/connectal-examples/simple.git and to select the right build target). Otherwise, continue with this step to download and compile the design locally.

Check out an example project and compile build it for the board you have installed (kc705)

git clone  https://github.com/connectal-examples/simple.git
cd simple
make CONNECTALDIR=/usr/share/connectal IPDIR=~/connectalip build.kc705

finally, run the example:

make CONNECTALDIR=/usr/share/connectal IPDIR=~/connectalip run.kc705

If this your first attempt after installing the board, the run command will fail with the following error (or similar):

Failed to open /dev/portal1 fd=-1 errno=2

If this is the case, reboot your host machine a second time (for BIOS PCIe detection) and re-invoke the run command:

mdk@xg06:~/sandbox/simple$ make CONNECTALDIR=/usr/share/connectal IPDIR=~/connectalip run.kc705
make -C kc705 BOARD=kc705 --no-print-directory run
/usr/share/connectal/scripts/run.pcietest bin/mk*.bin.gz bin/ubuntu.exe 
+ set -e
+ dirname /usr/share/connectal/scripts/run.pcietest
+ cd /usr/share/connectal/scripts
+ pwd
+ export SCRIPT_DIR=/usr/share/connectal/scripts
+ echo run.pcie parameters are: bin/mkTop.bin.gz bin/ubuntu.exe
run.pcie parameters are: bin/mkTop.bin.gz bin/ubuntu.exe
+ SSHPARAM= -o StrictHostKeyChecking=no
+ [  !=  ]
+ BOARD_SERIAL=
+ [  !=  ]
+ TIMELIMIT=3m
+ [  !=  ]
+ [  != 1 ]
+ fpgajtag bin/mkTop.bin.gz
fpgajtag: Digilent:Digilent Adept USB Device:210203339470; bcd:700
fpgajtag: unzip input file, len 731639
fpgajtag: bypass already programmed bc
fpgajtag: bypass already programmed bc
fpgajtag: bypass already programmed bc
STATUS 00401079 done 0 release_done 0 eos 10 startup_state 0
fpgajtag: Starting to send file
fpgajtag: Done sending file
STATUS 00401079 done 0 release_done 0 eos 10 startup_state 0
Running /usr/bin/pciescan.sh
+ PATH=/scratch/Xilinx/Vivado/2014.1/bin:/scratch/bluespec/Bluespec-2014.05.beta1/bin:/scratch/arm-2009q1/bin:/home/mdk/bin:/scratch/android-ndk-r9d:/scratch/jdk1.6.0_45/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/sbin
++ lspci -d 1be7:c100
++ sed -e 's/ .*//'
+ BLUEDEVICE=03:00.0
+ '[' 03:00.0 '!=' '' ']'
+ sh -c 'echo 1 >/sys/bus/pci/devices/0000:03:00.0/remove'
+ rmmod pcieportal
+ sh -c 'echo 1 >/sys/bus/pci/rescan'
+ sleep 1
+ timeout 3m catchsegv bin/ubuntu.exe
Portal::registerInstance fpga1 fd 3 clients 0
portalExec::about to enter loop, numFds=1
Main::calling say1(42)
Main::calling say2(2, 4)
Main::calling say3(S1{a:3,b:6})
Main::calling say4(S2{a:7,b:8,c:9})
Main::calling say5(00000000, deadbeeffecafeca, 00000001)
Main::calling say6(bbbbbbbb, 000000effecafeca, cccccccc)
Main::calling say7(dadadada, 00000001)
Main::calling say8
say1(42)
say2(2 4)
say3(S1{a:3,b:6})
say4(S2{a:7,b:8,c:9})
Main::about to go to sleep
say5(00000000, deadbeeffecafeca, 00000001)
say6(bbbbbbbb, 000000effecafeca, cccccccc)
say7(dadadada, 00000001)
say8
    [0] = 0x0
    [1] = 0xffffffe0
    [2] = 0xffffffc0
    [3] = 0xffffffa0
    [4] = 0xffffff80
    [5] = 0xffffff60
    [6] = 0xffffff40
    [7] = 0xffffff20
    [8] = 0xffffff00
    [9] = 0xfffffee0
    [10] = 0xfffffec0
    [11] = 0xfffffea0
    [12] = 0xfffffe80
    [13] = 0xfffffe60
    [14] = 0xfffffe40
    [15] = 0xfffffe20
    [16] = 0xfffffe00
    [17] = 0xfffffde0
    [18] = 0xfffffdc0
    [19] = 0xfffffda0
    [20] = 0xfffffd80
    [21] = 0xfffffd60
    [22] = 0xfffffd40
    [23] = 0xfffffd20
    [24] = 0xfffffd00
    [25] = 0xfffffce0
    [26] = 0xfffffcc0
    [27] = 0xfffffca0
    [28] = 0xfffffc80
    [29] = 0xfffffc60
    [30] = 0xfffffc40
    [31] = 0xfffffc20
    [32] = 0xfffffc00
    [33] = 0xfffffbe0
    [34] = 0xfffffbc0
    [35] = 0xfffffba0
    [36] = 0xfffffb80
    [37] = 0xfffffb60
    [38] = 0xfffffb40
    [39] = 0xfffffb20
    [40] = 0xfffffb00
    [41] = 0xfffffae0
    [42] = 0xfffffac0
    [43] = 0xfffffaa0
    [44] = 0xfffffa80
    [45] = 0xfffffa60
    [46] = 0xfffffa40
    [47] = 0xfffffa20
    [48] = 0xfffffa00
    [49] = 0xfffff9e0
    [50] = 0xfffff9c0
    [51] = 0xfffff9a0
    [52] = 0xfffff980
    [53] = 0xfffff960
    [54] = 0xfffff940
    [55] = 0xfffff920
    [56] = 0xfffff900
    [57] = 0xfffff8e0
    [58] = 0xfffff8c0
    [59] = 0xfffff8a0
    [60] = 0xfffff880
    [61] = 0xfffff860
    [62] = 0xfffff840
    [63] = 0xfffff820
    [64] = 0xfffff800
    [65] = 0xfffff7e0
    [66] = 0xfffff7c0
    [67] = 0xfffff7a0
    [68] = 0xfffff780
    [69] = 0xfffff760
    [70] = 0xfffff740
    [71] = 0xfffff720
    [72] = 0xfffff700
    [73] = 0xfffff6e0
    [74] = 0xfffff6c0
    [75] = 0xfffff6a0
    [76] = 0xfffff680
    [77] = 0xfffff660
    [78] = 0xfffff640
    [79] = 0xfffff620
    [80] = 0xfffff600
    [81] = 0xfffff5e0
    [82] = 0xfffff5c0
    [83] = 0xfffff5a0
    [84] = 0xfffff580
    [85] = 0xfffff560
    [86] = 0xfffff540
    [87] = 0xfffff520
    [88] = 0xfffff500
    [89] = 0xfffff4e0
    [90] = 0xfffff4c0
    [91] = 0xfffff4a0
    [92] = 0xfffff480
    [93] = 0xfffff460
    [94] = 0xfffff440
    [95] = 0xfffff420
    [96] = 0xfffff400
    [97] = 0xfffff3e0
    [98] = 0xfffff3c0
    [99] = 0xfffff3a0
    [100] = 0xfffff380
    [101] = 0xfffff360
    [102] = 0xfffff340
    [103] = 0xfffff320
    [104] = 0xfffff300
    [105] = 0xfffff2e0
    [106] = 0xfffff2c0
    [107] = 0xfffff2a0
    [108] = 0xfffff280
    [109] = 0xfffff260
    [110] = 0xfffff240
    [111] = 0xfffff220
    [112] = 0xfffff200
    [113] = 0xfffff1e0
    [114] = 0xfffff1c0
    [115] = 0xfffff1a0
    [116] = 0xfffff180
    [117] = 0xfffff160
    [118] = 0xfffff140
    [119] = 0xfffff120
    [120] = 0xfffff100
    [121] = 0xfffff0e0
    [122] = 0xfffff0c0
    [123] = 0xfffff0a0
    [124] = 0xfffff080
    [125] = 0xfffff060
    [126] = 0xfffff040
    [127] = 0xfffff020
+ [  !=  ]
+ pcieflat
mdk@xg06:~/sandbox/simple

mdk@xg06:~/sandbox/simple$ make CONNECTALDIR=/usr/share/connectal IPDIR=~/connectalip run.kc705
make -C kc705 BOARD=kc705 --no-print-directory run /usr/share/connectal/scripts/run.pcietest bin/mk*.bin.gz bin/ubuntu.exe + set -e + dirname /usr/share/connectal/scripts/run.pcietest + cd /usr/share/connectal/scripts + pwd + export SCRIPT_DIR=/usr/share/connectal/scripts + echo run.pcie parameters are: bin/mkTop.bin.gz bin/ubuntu.exe run.pcie parameters are: bin/mkTop.bin.gz bin/ubuntu.exe + SSHPARAM= -o StrictHostKeyChecking=no + [ != ] + BOARD_SERIAL= + [ != ] + TIMELIMIT=3m + [ != ] + [ != 1 ] + fpgajtag bin/mkTop.bin.gz fpgajtag: Digilent:Digilent Adept USB Device:210203339470; bcd:700 fpgajtag: unzip input file, len 731639 fpgajtag: bypass already programmed bc fpgajtag: bypass already programmed bc fpgajtag: bypass already programmed bc STATUS 00401079 done 0 release_done 0 eos 10 startup_state 0 fpgajtag: Starting to send file fpgajtag: Done sending file STATUS 00401079 done 0 release_done 0 eos 10 startup_state 0 Running /usr/bin/pciescan.sh + PATH=/scratch/Xilinx/Vivado/2014.1/bin:/scratch/bluespec/Bluespec-2014.05.beta1/bin:/scratch/arm-2009q1/bin:/home/mdk/bin:/scratch/android-ndk-r9d:/scratch/jdk1.6.0_45/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/sbin ++ lspci -d 1be7:c100 ++ sed -e 's/ .*//' + BLUEDEVICE=03:00.0 + '[' 03:00.0 '!=' '' ']' + sh -c 'echo 1 >/sys/bus/pci/devices/0000:03:00.0/remove' + rmmod pcieportal + sh -c 'echo 1 >/sys/bus/pci/rescan' + sleep 1 + timeout 3m catchsegv bin/ubuntu.exe Portal::registerInstance fpga1 fd 3 clients 0 portalExec::about to enter loop, numFds=1 Main::calling say1(42) Main::calling say2(2, 4) Main::calling say3(S1{a:3,b:6}) Main::calling say4(S2{a:7,b:8,c:9}) Main::calling say5(00000000, deadbeeffecafeca, 00000001) Main::calling say6(bbbbbbbb, 000000effecafeca, cccccccc) Main::calling say7(dadadada, 00000001) Main::calling say8 say1(42) say2(2 4) say3(S1{a:3,b:6}) say4(S2{a:7,b:8,c:9}) Main::about to go to sleep say5(00000000, deadbeeffecafeca, 00000001) say6(bbbbbbbb, 000000effecafeca, cccccccc) say7(dadadada, 00000001) say8 [0] = 0x0 [1] = 0xffffffe0 [2] = 0xffffffc0 [3] = 0xffffffa0 [4] = 0xffffff80 [5] = 0xffffff60 [6] = 0xffffff40 [7] = 0xffffff20 [8] = 0xffffff00 [9] = 0xfffffee0 [10] = 0xfffffec0 [11] = 0xfffffea0 [12] = 0xfffffe80 [13] = 0xfffffe60 [14] = 0xfffffe40 [15] = 0xfffffe20 [16] = 0xfffffe00 [17] = 0xfffffde0 [18] = 0xfffffdc0 [19] = 0xfffffda0 [20] = 0xfffffd80 [21] = 0xfffffd60 [22] = 0xfffffd40 [23] = 0xfffffd20 [24] = 0xfffffd00 [25] = 0xfffffce0 [26] = 0xfffffcc0 [27] = 0xfffffca0 [28] = 0xfffffc80 [29] = 0xfffffc60 [30] = 0xfffffc40 [31] = 0xfffffc20 [32] = 0xfffffc00 [33] = 0xfffffbe0 [34] = 0xfffffbc0 [35] = 0xfffffba0 [36] = 0xfffffb80 [37] = 0xfffffb60 [38] = 0xfffffb40 [39] = 0xfffffb20 [40] = 0xfffffb00 [41] = 0xfffffae0 [42] = 0xfffffac0 [43] = 0xfffffaa0 [44] = 0xfffffa80 [45] = 0xfffffa60 [46] = 0xfffffa40 [47] = 0xfffffa20 [48] = 0xfffffa00 [49] = 0xfffff9e0 [50] = 0xfffff9c0 [51] = 0xfffff9a0 [52] = 0xfffff980 [53] = 0xfffff960 [54] = 0xfffff940 [55] = 0xfffff920 [56] = 0xfffff900 [57] = 0xfffff8e0 [58] = 0xfffff8c0 [59] = 0xfffff8a0 [60] = 0xfffff880 [61] = 0xfffff860 [62] = 0xfffff840 [63] = 0xfffff820 [64] = 0xfffff800 [65] = 0xfffff7e0 [66] = 0xfffff7c0 [67] = 0xfffff7a0 [68] = 0xfffff780 [69] = 0xfffff760 [70] = 0xfffff740 [71] = 0xfffff720 [72] = 0xfffff700 [73] = 0xfffff6e0 [74] = 0xfffff6c0 [75] = 0xfffff6a0 [76] = 0xfffff680 [77] = 0xfffff660 [78] = 0xfffff640 [79] = 0xfffff620 [80] = 0xfffff600 [81] = 0xfffff5e0 [82] = 0xfffff5c0 [83] = 0xfffff5a0 [84] = 0xfffff580 [85] = 0xfffff560 [86] = 0xfffff540 [87] = 0xfffff520 [88] = 0xfffff500 [89] = 0xfffff4e0 [90] = 0xfffff4c0 [91] = 0xfffff4a0 [92] = 0xfffff480 [93] = 0xfffff460 [94] = 0xfffff440 [95] = 0xfffff420 [96] = 0xfffff400 [97] = 0xfffff3e0 [98] = 0xfffff3c0 [99] = 0xfffff3a0 [100] = 0xfffff380 [101] = 0xfffff360 [102] = 0xfffff340 [103] = 0xfffff320 [104] = 0xfffff300 [105] = 0xfffff2e0 [106] = 0xfffff2c0 [107] = 0xfffff2a0 [108] = 0xfffff280 [109] = 0xfffff260 [110] = 0xfffff240 [111] = 0xfffff220 [112] = 0xfffff200 [113] = 0xfffff1e0 [114] = 0xfffff1c0 [115] = 0xfffff1a0 [116] = 0xfffff180 [117] = 0xfffff160 [118] = 0xfffff140 [119] = 0xfffff120 [120] = 0xfffff100 [121] = 0xfffff0e0 [122] = 0xfffff0c0 [123] = 0xfffff0a0 [124] = 0xfffff080 [125] = 0xfffff060 [126] = 0xfffff040 [127] = 0xfffff020 + [ != ] + pcieflat mdk@xg06:~/sandbox/simple$

lt;/p>