Commit eef93632 authored by Maciej Lipinski's avatar Maciej Lipinski

Merge branch 'proposed_master' into 'master'

Tests: docker & compilation

See merge request !1
parents e6fbc7b4 dfee04e2
# .gitignore file
xcompiler/*
# OS generated files #
######################
*.bak
......
[submodule "spec-sw"]
path = spec-sw
url = git://ohwr.org/fmc-projects/spec/spec-sw.git
[submodule "etherbone"]
path = etherbone
url = git://ohwr.org/hdl-core-lib/etherbone-core.git
url = https://ohwr.org/project/spec-sw.git
[submodule "wr-nic"]
path = wr-nic
url = https://ohwr.org/project/wr-nic.git
[submodule "fmc-dio"]
path = fmc-dio
url = https://ohwr.org/project/fmc-dio-5chttla.git
[submodule "wrpc-sw"]
path = wrpc-sw
url = https://ohwr.org/project/wrpc-sw.git
[submodule "coht-vic"]
path = coht-vic
url = https://gitlab.cern.ch/cohtdrivers/coht-vic.git
......@@ -14,30 +14,40 @@
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
########################################################################
SUBMOD_DIRS=spec-sw etherbone
MAKE_DIRS = spec-sw etherbone/api #tools
SUBMOD_DIRS=spec-sw wr-nic fmc-dio coht-vic
MAKE_DIRS = spec-sw wr-nic fmc-dio coht-vic #tools
#RUNME := $(shell test -d $(FMC_DRV) || git submodule update --init)
LM32_XCOMPILER_URL="https://www.ohwr.org/project/wrpc-sw/uploads/2776ce0ba43503d1486ae205b48fb450"
LM32_XCOMPILER_NAME="lm32_host_64bit.tar.xz"
XCOMPILER_DIR="xcompiler"
LM32_XCOMPILER_NAME_DIR="lm32-gcc-4.5.3"
#RUNME := $(shell test -d $(FMC_DRV) || git submodule update --init)
## Call the sub folder Makefiles
all clean install: init
@for d in $(MAKE_DIRS); do $(MAKE) -C $$d $@ || exit 1; done
@if [ "x$@" = "xinstall" ]; then ./scripts/wr-ssk-get -i; fi
@if [ "x$@" = "xinstall" ]; then ./scripts/wr-ssk-get -i; cp wrpc-sw/tools/wrpc-vuart /usr/local/sbin; fi
## Init repo and create the .INIT file to not do it again
init: .INIT
.INIT:
git submodule init
.INIT:
git submodule init
@ $(MAKE) update
@ $(MAKE) patch
@touch .INIT; \
patch:
./scripts/wr-git-patch
## Force updating the submodules and fetch new gateware
update:
./scripts/wr-ssk-get -f
git submodule update
cd spec-sw
git submodule update
@rm -rf $(XCOMPILER_DIR)
mkdir -p $(XCOMPILER_DIR)
cd $(XCOMPILER_DIR) && wget $(LM32_XCOMPILER_URL)/$(LM32_XCOMPILER_NAME) \
&& tar xvf $(LM32_XCOMPILER_NAME)
cd wrpc-sw && make spec_defconfig && \
CROSS_COMPILE="$(shell pwd)/$(XCOMPILER_DIR)/$(LM32_XCOMPILER_NAME_DIR)/bin/lm32-elf-" make
coht-vic @ b4431e73
Subproject commit b4431e739bbc5a4ed1701ab7f4a372fbb4f33cf8
......@@ -23,8 +23,8 @@ PDF=$(addprefix pdf/, $(SRC:.md=.pdf))
TEX=$(SRC:.md=.tex)
## Pandoc arguments
OPTIONS=-f markdown --toc --number-sections --smart
TEMPLATE=pandoc.latex
OPTIONS?=-s --from markdown+yaml_metadata_block --toc --number-sections --smart
TEMPLATE=pandoc.latex
ifneq "$(TEMPLATE)" ""
......@@ -42,11 +42,19 @@ DATE = $(shell date +"%d %b. %Y")
all: $(PDF)
tex: $(TEX)
pdf: $(PDF)
verbose:
make OPTIONS="-s --from markdown+yaml_metadata_block --toc --number-sections --smart --verbose" -C . pdf
## Special targets to create directory
DIR_%:
mkdir -p $(subst DIR_,,$@)
pdf/wr-starting-kit.pdf: wr-starting-kit.md Makefile $(TEMPLATE) DIR_pdf
pandoc $(OPTIONS) --latex-engine=xelatex --listings --highlight-style=haddock $(TEMPLATEARG) \
-V title="WR Starting Kit" -V subtitle="User Guide" -V author="Seven Solutions" \
-V lang=english -V fontsize=11pt -V documentclass=article -V bg-color=238,245,240 -V date="$(DATE) - $(VERSION)" -o $@ $<
pdf/%.pdf: %.md Makefile $(TEMPLATE) DIR_pdf
pandoc $(OPTIONS) --latex-engine=xelatex --listings --highlight-style=haddock $(TEMPLATEARG) \
-V lang=english -V fontsize=11pt -V documentclass=article -V bg-color=238,245,240 -V date="$(DATE) - $(VERSION)" -o $@ $<
......
---
title: 'Generate WR Starting Kit Documentation'
subtitle: "How to generate starting kit pdf from markdown using pandoc"
author: Seven Solutions
...
Intro
==========
The document has been written in markdown format and can be directly
read from github, gitlab or bitbucket
PDF Generation
===============
You might need to install `pandoc` software to generate `.pdf` from `.md`.
sudo apt-get install pandoc
To generate a specific document you should enter its own directory and execute
make
If you have some Latex compilation error please install the following packages
sudo apt-get install texlive texlive-latex-extra
### pandoc.latex
The file pandoc.latex is a latex template in order to add all special latex customization
to the markdown file. In case some of latex package are not working properly, the user
should try to modify this file.
Syntax
===========
> ***NOTES:*** The syntax used in this document is Markdown. We recommand to follow the strict
markdown syntax explained on [bitbucket](https://bitbucket.org/tutorials/markdowndemo).
Misc
======
Dirty tags
--------------
During compilation of `fmc-bus` kernel, the Make generated files that should be .gitignore.
If you want to clean the tags of the repos you can use the following command to manually clean
everything:
~~~~~{.bash}
### Find dirty files:
git submodule foreach --recursive git status
### Remove them
find ./ -wholename "*fmc-bus/kernel/.cache.mk" -delete
find ./ -wholename "*fmc-bus/kernel/fmc-chardev.o.ur-safe" -delete
~~~~~~~~
doc/img/ssk_ txpps.png

61.2 KB | W: | H:

doc/img/ssk_ txpps.png

90.5 KB | W: | H:

doc/img/ssk_ txpps.png
doc/img/ssk_ txpps.png
doc/img/ssk_ txpps.png
doc/img/ssk_ txpps.png
  • 2-up
  • Swipe
  • Onion skin
doc/img/ssk_100Hz.png

191 KB | W: | H:

doc/img/ssk_100Hz.png

140 KB | W: | H:

doc/img/ssk_100Hz.png
doc/img/ssk_100Hz.png
doc/img/ssk_100Hz.png
doc/img/ssk_100Hz.png
  • 2-up
  • Swipe
  • Onion skin
File mode changed from 100755 to 100644
doc/img/ssk_configs.png

72.8 KB | W: | H:

doc/img/ssk_configs.png

40.4 KB | W: | H:

doc/img/ssk_configs.png
doc/img/ssk_configs.png
doc/img/ssk_configs.png
doc/img/ssk_configs.png
  • 2-up
  • Swipe
  • Onion skin
doc/img/ssk_inside.jpg

460 KB | W: | H:

doc/img/ssk_inside.jpg

384 KB | W: | H:

doc/img/ssk_inside.jpg
doc/img/ssk_inside.jpg
doc/img/ssk_inside.jpg
doc/img/ssk_inside.jpg
  • 2-up
  • Swipe
  • Onion skin
File mode changed from 100755 to 100644
doc/img/ssk_playdio.png

15.9 KB | W: | H:

doc/img/ssk_playdio.png

41.4 KB | W: | H:

doc/img/ssk_playdio.png
doc/img/ssk_playdio.png
doc/img/ssk_playdio.png
doc/img/ssk_playdio.png
  • 2-up
  • Swipe
  • Onion skin
doc/img/ssk_pps-setup.png

34.8 KB | W: | H:

doc/img/ssk_pps-setup.png

67 KB | W: | H:

doc/img/ssk_pps-setup.png
doc/img/ssk_pps-setup.png
doc/img/ssk_pps-setup.png
doc/img/ssk_pps-setup.png
  • 2-up
  • Swipe
  • Onion skin
doc/img/ssk_sfp.jpg

351 KB | W: | H:

doc/img/ssk_sfp.jpg

285 KB | W: | H:

doc/img/ssk_sfp.jpg
doc/img/ssk_sfp.jpg
doc/img/ssk_sfp.jpg
doc/img/ssk_sfp.jpg
  • 2-up
  • Swipe
  • Onion skin
File mode changed from 100755 to 100644
This diff is collapsed.
This diff is collapsed.
etherbone @ d1b6b4bd
Subproject commit d1b6b4bd5b1fff8d50adc02665348814c40bb536
Subproject commit eea7bfc82e4cb3554d4343d93dfa75773d7b2fc2
Folder to places patches to apply before compiling the starting kit.
If empty calling this folder will do nothing
#! /bin/bash
# ******************************************************************************
# @file eb-mem.sh
# @brief Script to use easy Etherbone tools
#
# Copyright (C) 2013
#
# Memory access with Etherbone tools
#
# @author Miguel Jimenez Lopez <klyone@ugr.es>
#
# @bug none!
#
# ******************************************************************************
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http//www.gnu.org/licenses/>.
# ******************************************************************************
print_help() {
echo ""
echo "############################################################################"
echo ""
echo "Command: eb-mem <options>"
echo ""
echo "--read|-r: Perform a read operation. It needs a IP and memory address."
echo "--write|-w: Perform a write operation. It needs a IP, memory address and value."
echo "--scan|-s: Perform a scan operation. It needs a IP address."
echo "--compact|-c: Use compact format. Perform a read or write operation depending on arguments"
echo "--tcp|-t: Use TCP packets to communication."
echo "--udp|-u: Use UDP packets to communication."
echo "--bytes|-b: Indicates n-bytes alignment of memory."
echo "--ip|-i: Device IP address."
echo "--port|-p: Use a determinate port."
echo "--address|-a: Device address to read/write access."
echo "--value|-v: Value to write into device."
echo "--help|-h: Show this help."
echo ""
echo "NOTE: This script does not try to implement all options of Etherbone tools."
echo "If you want to execute these operations with other options, you must use "
echo "original tools developped by Etherbone team!!"
echo ""
echo "Examples:"
echo ""
echo "eb-mem --scan --ip 10.10.10.10"
echo "eb-mem --read --ip 10.10.10.10 --address 0x64233"
echo "eb-mem --write --ip 10.10.10.10 --address 0x64233 --value 0x123"
echo "(COMPACT READ) => eb-mem --compact --ip 10.10.10.10 --address 0x64233"
echo "(COMPACT WRITE) => eb-mem --compact --ip 10.10.10.10 --address 0x64233 --value 0x124"
echo ""
echo "############################################################################"
echo ""
}
nargs=$#
EB_TOOLS=${EB_TOOLS-../etherbone/api/tools}
n=0
mode='none'
t_transport='udp'
bytes=4
port=''
ip='none'
address='none'
value='none'
while (($n < $nargs)) ;
do
arg=$1
case $arg in
--read|-r) mode='read'; ;;
--write|-w) mode='write' ;;
--scan|-s) mode='scan' ;;
--compact|-c) mode='compact' ;;
--tcp|-t) t_transport='tcp' ;;
--udp|-u) t_transport='udp' ;;
--bytes|-b) shift; bytes=$1 ;;
--ip|-i) shift; ip=$1 ;;
--port|-p) shift; port="/$1";;
--address|-a) shift; address=$1 ;;
--value|-v) shift; value=$1 ;;
--help|-h) print_help ; exit 0;;
esac
n=$n+1
shift
done
if [ "$mode" = 'none' ];
then
echo "You must get access mode: --scan|--read|--write"
exit -1
fi
if [ "$ip" = 'none' ];
then
echo "You must get IP address to connect with Etherbone core"
exit -1
fi
case $mode in
scan) $EB_TOOLS/eb-ls $t_transport/$ip$port;;
read) if [ "$address" = 'none' ];
then
echo "You must get memory address in read operation"
exit -1
fi
$EB_TOOLS/eb-read $t_transport/$ip$port $address/$bytes
;;
write) if [ "$address" = 'none' ];
then
echo "You must get memory address in write operation"
exit -1
fi
if [ "$value" = 'none' ];
then
echo "You must get value in write operation"
exit -1
fi
$EB_TOOLS/eb-write $t_transport/$ip$port $address/$bytes $value
;;
compact) if [ "$address" = 'none' ];
then
echo "You must get memory address in read or write operation"
exit -1
fi
if [ "$value" = 'none' ];
then
$EB_TOOLS/eb-read $t_transport/$ip$port $address/$bytes
else
$EB_TOOLS/eb-write $t_transport/$ip$port $address/$bytes $value
fi
esac
#!/bin/dash
## Script to apply git patches for submodules.
##
## Authors:
## - Miguel Jimenez Lopez (Seven Solutions, www.sevensols.com)
##
## GNU Lesser General Public License Usage
## This file may be used under the terms of the GNU Lesser
## General Public License version 2.1 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL included in the
## packaging of this file. Please review the following information to
## ensure the GNU Lesser General Public License version 2.1 requirements
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
#######################################################################################################
### Show help of the function
help ()
{
cat << EOF
Usage: $(basename $0) [Options]
Options:
-h|--help) Show this little help
EOF
exit 0
}
#################################################
### Main execution
GIT_REPOS="spec-sw wrpc-sw wr-nic fmc-dio coht-vic"
MAIN_DIR=".."
PATCHES_DIR="patches"
# setup script dir
sdir=$(dirname $0)
cd $sdir
sdir=$(pwd)
while [ $# -gt 0 ]; do # Until you run out of parameters . . .
case "$1" in
-h|--help) help;;
*) help;;
esac
shift # Check next set of parameters.
done
for i in $GIT_REPOS
do
if [ -e "$sdir/$MAIN_DIR/$PATCHES_DIR/$i" ] ; then
echo "Patching $i submodule"
cd "$sdir/$MAIN_DIR/$i"
git am $sdir/$MAIN_DIR/$PATCHES_DIR/$i/*.patch
cd "$sdir"
fi
done
......@@ -106,7 +106,11 @@ insthdl()
if [ ! -d ${installdir} ]; then
sudo mkdir -p ${installdir}
fi
sudo cp -v ${DOWNLOADDIR}/spec-init.bin ${DOWNLOADDIR}/wr_nic_dio.bin ${installdir}
sudo cp -v ${DOWNLOADDIR}/spec-init.bin \
${DOWNLOADDIR}/wr_nic_dio.bin \
${DOWNLOADDIR}/wr_nic.bin \
${DOWNLOADDIR}/wr_nic_lm32_sw.bin \
${installdir}
wr_echoret $? "OK" "ERROR"
checkdrv;
......@@ -290,7 +294,7 @@ exit 0
# setup script dir
scriptdir=$(cd $(dirname $0); pwd)
DOWNLOADDIR=${scriptdir}/../firmware
PKGURL="http://www.ohwr.org/attachments/download/2744/wr-starting-kit-v2.0_gw.tar.gz 9e48bbe6c30b18864ecddceb7627e6e9"
PKGURL="https://ohwr.org/project/wr-starting-kit/wikis/uploads/b63d12f90cd0dbb89b78587603fdcfe6/wr-starting-kit-v3.0_bin.tar.gz"
while [ $# -gt 0 ]; do # Until you run out of parameters . . .
case "$1" in
......
Subproject commit eb9b9d03e3f54657fe29fca93021e2b45380da05
Subproject commit e76f5ca3bcda171318757b603abca131712d086e
# .gitignore file
# configuration file #
######################
configuration.cfg
Tests for WR-starting-kit.
This folder contains test files, documentation file and docker deployment files.
The folders are structured as following:
* `doc`: File documentation.
* `dockers`: Files Dockerfile to deploy WR-starting-kit in differents SO and kernerls.
* `validation`: Python files for tests.
\ No newline at end of file
Dokerfiles to deployment test
==========================
To build image
----------
You need to move to UbuntuXX folder and execute:
sudo docker build -t <name image> .
To run image
----------
You need to execute:
sudo docker run -it <name image>
Show images
----------
sudo docker images
Remove image
----------
sudo docker rmi -f <IMAGE ID>
\ No newline at end of file
# spec-sw Dockerfile ubuntu 16.04
#
#
# Pull base image.
FROM ubuntu:16.04
# Install.
RUN \
apt-get update &&\
apt-get upgrade -y &&\
apt-get install -y git \
build-essential \
python-minimal \
wget \
libreadline-dev \
kmod \
linux-headers-4.4.0-21-generic \
linux-headers-4.8.0-34-generic \
linux-headers-4.10.0-14-generic \
linux-headers-4.13.0-16-generic \
linux-headers-4.15.0-13-generic
# Clone repository and detach HEAD
RUN \
git clone https://ohwr.org/project/wr-starting-kit.git &&\
cd wr-starting-kit &&\
# TODO: preliminary commit for wr-starting-kit-v3.0
git checkout 50f368abff0d4aed8223858f552b3184249695d2
# The kernel version 4.4.0-21-generic does not work
#set enviroment variable for kernel version 4.8.0-34-generic
ENV LINUX /lib/modules/4.8.0-34-generic/build
#construction spec-sw for kernel version 4.8.0-34-generic
RUN \
cd wr-starting-kit &&\
make clean &&\
make &&\
make install
#set enviroment variable for kernel version 4.10.0-14-generic
ENV LINUX /lib/modules/4.10.0-14-generic/build
#construction spec-sw for kernel version 4.10.0-14-generic
RUN \
cd wr-starting-kit &&\
make clean &&\
make &&\
make install
#set enviroment variable for kernel version 4.13.0-16-generic
ENV LINUX /lib/modules/4.13.0-16-generic/build
#construction spec-sw for kernel version 4.13.0-16-generic
RUN \
cd wr-starting-kit &&\
make clean &&\
make &&\
make install
#set enviroment variable for kernel version 4.15.0-13-generic
ENV LINUX /lib/modules/4.15.0-13-generic/build
#construction spec-sw for kernel version 4.15.0-13-generic
RUN \
cd wr-starting-kit &&\
make clean &&\
make &&\
make install
#create file FRU
RUN \
cd /wr-starting-kit/spec-sw/fmc-bus/tools &&\
FRU_VENDOR="CERN" FRU_NAME="FmcDio5cha" FRU_PART="EDA-02408-V2-0" \
./fru-generator -s 7S-WR-FMCDIO5ch-2.0-Sx.yyy > example.bin
# Define default command.
CMD ["bash"]
#
# spec-sw Dockerfile ubuntu 18.04
#
#
# Pull base image.
FROM ubuntu:18.04
# Install.
RUN \
apt-get update &&\
apt-get upgrade -y &&\
apt-get install -y git \
build-essential \
python-minimal \
wget \
libreadline-dev \
kmod \
linux-headers-4.15.0-47-generic \
linux-headers-4.18.0-17-generic
# Clone repository and detach HEAD
RUN \
git clone https://ohwr.org/project/wr-starting-kit.git &&\
cd wr-starting-kit &&\
# TODO: preliminary commit for wr-starting-kit-v3.0
git checkout 50f368abff0d4aed8223858f552b3184249695d2
#set enviroment variable for kernel version 4.15.0-47-generic
ENV LINUX /lib/modules/4.15.0-47-generic/build
#construction spec-sw for kerner version 4.15.0-47-generic
RUN \
cd wr-starting-kit &&\
make &&\
make install
#set enviroment variable for kernel version 4.18.0-17-generic
ENV LINUX /lib/modules/4.18.0-17-generic/build
#construction spec-sw for kernel version 4.18.0-17-generic
RUN \
cd wr-starting-kit &&\
make clean &&\
make &&\
make install
#create file FRU
RUN \
cd /wr-starting-kit/spec-sw/fmc-bus/tools &&\
FRU_VENDOR="CERN" FRU_NAME="FmcDio5cha" FRU_PART="EDA-02408-V2-0" \
./fru-generator -s 7S-WR-FMCDIO5ch-2.0-Sx.yyy > example.bin
# Define default command.
CMD ["bash"]
The files in this folder are the following:
* `dio.py`: Class to interact with the ports of the board.
* `loadDriver.py`: Load the driver on the PC.
* `sample.cfg`: Sample configuration file of the tests, to execute the tests must be modified the parameters and renamed the file to `configuration.cfg`.
* `ssh.py`: Class used to execute commands by SSH.
* `testAdvDIO.py`: Verifies the correct reception and sending of packages.
* `testAll.py`: Execute all tests.
* `testDIO.py`: Check all ports of the boards.
* `testNIC.py`: Verifies the correct operation of the Network Interface Core.
* `testWR.py`: Check the correct operation of White Rabbit.
* `vuart.py`: Class to execute commands by virtual uart.
# @file dio.py
#
# @brief This class is to interact with the ports of the board
#
# @author Manuel Castilla
# @date 23/04/2019
#
###########################################################################
from ssh import SshCmd,SshCmdException
## Class DIO
#
class DIO ():
def __init__(self,hostName,userName,password,busId):
"""
Construcctor
Args:
hostName: ip or hostname
userName: username
password : password
busId: number PCIe bus
"""
self.hostName = hostName
self.userName = userName
self.password = password
self.busId = busId
self.command = "sudo wr-dio-cmd /dev/fmc-dio-%i:0" % int(busId,16)
self.sshCmd = SshCmd()
def configurePort(self,channel,mode):
"""
Configure the channel
Args:
channel: number 0 to 4
mode: I/i(Input), 0/1(Output, steady state fixed at 0 low or 1 high),D/d(DIO core output),
P/p(Channel 0 Output PPS),C/c(Channel 4 Clock Input to PTP core)
Raises:
error function
"""
try:
confCommand = self.command + " mode " + str(channel) + " " + mode
self.execCommand(confCommand)
except:
print("Error configure port, channel:",channel,"mode:",mode)
raise
def configurePorts(self,modechannels):
"""
Configure all channels
Args:
modechannels: <modech0><modech1><modech2><modech3><modech4>
Raises:
error function
"""
try:
confCommand = self.command + " mode " + modechannels
self.execCommand(confCommand)
except:
print("Error configure ports, mode channels:",modechannels)
raise
def armPulse(self,channel,period,count):
"""
generate a pulse in a channel
Args:
channel: number 0 to 4
period: pulse period
count: string whih number of instances to run
Raises:
error function
"""
try:
armCommand = self.command + " pulse " + str(channel) + " " + str(period) + " " + count
self.execCommand(armCommand)
except:
print("Error arm pulse, channel:",channel,"period:",period,"count:",count)
raise
def getTimestamp(self,channel):
"""
Get timestamp of channel
Args:
channel: number 0 to 4
Raises: