Commit a567c902 authored by Pascal Bos's avatar Pascal Bos

Moved all tools to the spec7-tools directory. Also added spec7 kernel module to the same directory


Added an script to load a bitfile over PCIe.

added kernel-module as submodule

updated default /dev entries to be compatible with new spec7-kernel-module.

added README
parent d2388486
......@@ -5,3 +5,6 @@
[submodule "sw/spec7-ps-sw"]
path = sw/spec7-ps-sw
url = https://ohwr.org/project/spec7-ps-sw.git
[submodule "sw/spec7-tools/spec7-kernel-module"]
path = sw/spec7-tools/spec7-kernel-module
url = https://gitlab.nikhef.nl/tond/spec7-kernel-module
#! /bin/bash
if [ "$1" = "-h" ]; then
echo "Copies and loads a bitfile to the spec7 over PCIe. Must be run as root"
echo "usage:
$0 NAME_OF_BITFILE.bit"
exit 1
fi
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
ID=$(lspci | grep "Xilinx Corporation Device 7022" | awk '{print $1}')
echo "removing Pcie entry."
echo 1 > /sys/bus/pci/devices/0000\:$ID/remove
sleep 0.2
echo "rescanning Pcie entries."
echo 1 > /sys/bus/pci/rescan
sleep 0.2
echo "Pcie entry loaded."
sleep 1
echo "dcache off" >/dev/ttyUSB1
echo "copying $1 to Spec7."
cp $1 /dev/spec7_bar4
echo "loading bitfile into pCap."
echo "fpga loadb 0 0x1000000 0x1000000" >/dev/ttyUSB1
echo "done"
......@@ -11,7 +11,7 @@ import sys
import argparse
parser = argparse.ArgumentParser(description='Spec7 tool to access the memory mapped area', epilog='A number with prefix "0x" is interpreted as hex value')
parser.add_argument('--device', '-d', default='/dev/xdma0_user', help = 'device path name, default is /dev/xdma0_user')
parser.add_argument('--device', '-d', default='/dev/spec7_bar0', help = 'device path name, default is /dev/spec7')
parser.add_argument('--address', '-a', default='0', help='address to access (0x prefix for hex)')
parser.add_argument('--is-pipe', '-p', dest='is_pipe', action="store_true", help='register is a pipe')
parser.add_argument('--count', '-n', dest='count', help='number of reads/writes')
......
#! /bin/bash
ID=$(lspci | grep "Xilinx Corporation Device 7022" | awk '{print $1}')
echo "removing Pcie entry...."
echo 1 > /sys/bus/pci/devices/0000\:$ID/remove
sleep 1
echo "rescanning Pcie entries...."
echo 1 > /sys/bus/pci/rescan
sleep 1
echo "done"
......@@ -22,7 +22,7 @@ vuart_addr = 0x40500
xmda_user_fd = 0;
parser = argparse.ArgumentParser(description='Terminal interface to the uart of the wr core on the SPEC card')
parser.add_argument('--device', '-d', default='/dev/xdma0_user', help = 'device path name, default is /dev/xdma0_user')
parser.add_argument('--device', '-d', default='/dev/spec7_bar0', help = 'device path name, default is /dev/spec7')
args = parser.parse_args()
......
SPEC7 Tools
-------------------
This is a software collection a various tools related to the SPEC7. Currently it holds 6 items
- PCIe_mm, A debug to quickly read and write memory in one of the BARs of the SPEC7.
- PCIe_rescan, A simple script to reload the PCIe entry. Mandatory after each programming.
- PCIe_vuart, A terminal interface to the uart of the WR core (BAR0).
- SMBus_reset, A simple script to Hard-reset (POR) the SPEC7 over the PCIe SMBus.
- PCIE_load_bitfile, A script to load and flash a bitfile over PCIe (WIP).
- spec7-kernel-module, Provides /dev/spec7_barX entries, and other userspace options.
PCIe_mm
--------------
This tool can be used to read and write to a certain adress. For example:
./spec7-tools/Pcie_mm/spec7_mm.py -a 0x0004
Will read address 0x0004.
./spec7-tools/Pcie_mm/spec7_mm.py -a 0x0004 -w 0xABBA
Will write 0xABBA to adress 0x0004
PCIe_rescan
------------
This scripts automaticly removes and rescans the SPEC7 PCIe device.
./spec7-tools/Pcie_rescan/Pcie_rescan.sh
Must be run as root.
PCIe_vuart
------------
A python script to emulate a termios terminal to utilize an uart connection on the White Rabbit ref design.
./spec7-tools/Pcie_vuart/spec7_vuart.py
SMBus_reset
------------
This script triggers a POR event on the SPEC7 via the PCIe's SMBus.
./spec7-tools/SMBus_reset/spec7_reset.sh
It uses i2c-tools so make sure you've probed i2c_dev beforehand.
./modprobe i2c_dev
PCIE_load_bitfile
------------
This script automatticly loads and flashes a new bitfile to the SPEC7.
./spec7-tools/Pcie_load_bitfile/Pcie_load_bitfile.sh ./spec7_wr_ref_top.bit
Must be run as root.
spec7-kernel-module
------------
The Kernel module written by the one and only Ton Damen. See that specific readme.md for more info.
It's mandatory to have installed to use all the previous tools (except the SMBus_reset).
Pascal Bos, bosp@nikhef.nl
Ton Damen, tond@nikhef.nl
September 2021
spec7-kernel-module @ 6e4797ba
Subproject commit 6e4797ba60bc99b5571c1bc2054ed65a2b300e8b
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment