Skip to content

Commit

Permalink
Merge pull request #313 from mithro
Browse files Browse the repository at this point in the history
Merge support for series 7 devices like the Arty, Nexys Video and NeTV2.
  • Loading branch information
mithro committed Oct 28, 2017
2 parents 2c43d00 + 06624f4 commit 89f5b66
Show file tree
Hide file tree
Showing 91 changed files with 3,435 additions and 960 deletions.
89 changes: 70 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
sudo: required

language:
- c

Expand All @@ -23,25 +21,11 @@ env:
global:
- HDMI2USB_UDEV_IGNORE=1
- CLEAN_CHECK=1
matrix:
# - PLATFORM=arty
- CPU=lm32 PLATFORM=atlys SKIP_TARGETS="hdmi2usb\|video.*"
- CPU=or1k PLATFORM=atlys TARGETS="base net"
- PLATFORM=atlys TARGET=video
- PLATFORM=atlys TARGET=hdmi2usb
- PLATFORM=minispartan6
# - PLATFORM=netv2
# - PLATFORM=nexys_video
# - PLATFORM=pipistrello
- CPU=lm32 PLATFORM=opsis SKIP_TARGETS="hdmi2usb\|video.*\|memtest"
- CPU=or1k PLATFORM=opsis TARGETS="base net"
- PLATFORM=opsis TARGET=video
- PLATFORM=opsis TARGET=hdmi2usb
# - PLATFORM=sim
- CPU=lm32 PLATFORM=mimasv2 TARGETS="base"
- CPU=or1k PLATFORM=mimasv2 TARGETS="base" # or1k and memtest don't fit on mimasv2

install:
- export CPU="$C"
- export PLATFORMS="$P"
- export TARGETS="$T"
- $PWD/.travis/setup.sh

script:
Expand All @@ -55,3 +39,70 @@ notifications:
- "chat.freenode.net#hdmi2usb"
template:
- "[%{repository_slug}/%{branch}#%{build_number}] (%{commit}): %{message} (%{build_url})"

jobs:
include:
#--------------------------------------------
# Base targets
#--------------------------------------------
# lm32 Base targets
- stage: Targets - Base
env: C=lm32 P=arty T="base net"

- stage: Targets - Base
env: C=lm32 P=atlys T="base net"

- stage: Targets - Base
env: C=lm32 P=mimasv2 T="base"

- stage: Targets - Base
env: C=lm32 P=minispartan6 T="base"

- stage: Targets - Base
env: C=lm32 P=netv2 T="base"

- stage: Targets - Base
env: C=lm32 P=nexys_video T="base net"

- stage: Targets - Base
env: C=lm32 P=opsis T="base net"

# - stage: Targets - Base
# env: C=lm32 P=pipistrello T="base"

# or1k base targets
- stage: Targets - Base
env: C=or1k P=arty T="base net"

- stage: Targets - Base
env: C=or1k P=atlys T="base net"

- stage: Targets - Base
env: C=or1k P=mimasv2 T="base"

- stage: Targets - Base
env: C=or1k P=opsis T="base net"

#--------------------------------------------
# Video Targets
#--------------------------------------------
- stage: Targets - Video
env: C=lm32 P=atlys T="video"

- stage: Targets - Video
env: C=lm32 P=netv2 T="video"

- stage: Targets - Video
env: C=lm32 P=nexys_video T="video"

- stage: Targets - Video
env: C=lm32 P=opsis T="video"

#--------------------------------------------
# HDMI2USB Targets
#--------------------------------------------
- stage: Targets - HDMI2USB
env: C=lm32 P=atlys T="hdmi2usb"

- stage: Targets - HDMI2USB
env: C=lm32 P=opsis T="hdmi2usb"
47 changes: 33 additions & 14 deletions .travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ echo "Running with PLATFORMS='$PLATFORMS'"

source scripts/enter-env.sh || exit 1

# How long to wait for "make gateware" to finish.
# Normal LiteX targets should take no longer than 20ish minutes on a modern
# machine. We round up to 40mins.
export GATEWARE_TIMEOUT=${GATEWARE_TIMEOUT:-2700}
export GATEWARE_KILLOUT=$((GATEWARE_TIMEOUT+60))
if [ -x /usr/bin/timeout ]; then
export GATEWARE_TIMEOUT_CMD="/usr/bin/timeout --kill-after=${GATEWARE_KILLOUT}s ${GATEWARE_TIMEOUT}s"
elif [ -x /usr/bin/timelimit ]; then
export GATEWARE_TIMEOUT_CMD="/usr/bin/timelimit -T $GATEWARE_KILLOUT -t $GATEWARE_TIMEOUT"
fi

ls -l $XILINX_DIR/opt/Xilinx/14.7/ISE_DS/ISE/bin/lin64/xreport
if [ -f $XILINX_DIR/opt/Xilinx/14.7/ISE_DS/ISE/bin/lin64/xreport ]; then
HAVE_XILINX_ISE=1
Expand Down Expand Up @@ -113,8 +124,12 @@ function build() {
echo "Skipping gateware"
make gateware-fake
else
FILTER=$PWD/.travis/run-make-gateware-filter.py \
make gateware || return 1
# Sometimes Xilinx ISE gets stuck and will never complete, we
# use timeout to prevent waiting here forever.
# FIXME: Should this be in the Makefile instead?
echo "Using $GATEWARE_TIMEOUT timeout (with '$GATEWARE_TIMEOUT_CMD')."
export FILTER=$PWD/.travis/run-make-gateware-filter.py
$GATEWARE_TIMEOUT_CMD time --verbose make gateware || return 1
fi
echo "============================================="

Expand Down Expand Up @@ -284,27 +299,31 @@ else
echo "============================================="
fi

if [ -z "$CPUS" ]; then
if [ -z "$CPU" ]; then
#CPUS="lm32 or1k riscv32"
CPUS="lm32 or1k"
else
CPUS="$CPU"
fi
fi

START_TARGET="$TARGET"
START_TARGETS="$TARGETS"
for PLATFORM in $PLATFORMS; do
if [ -z "$TARGETS" ]; then
if [ -z "$START_TARGETS" ]; then
if [ -z "$SKIP_TARGETS" ]; then
SKIP_TARGETS="__"
fi
if [ -z "$TARGET" -a -z "$TARGETS" ]; then
TARGETS=$(ls targets/${PLATFORM}/*.py | grep -v "__" | grep -v "$SKIP_TARGETS" | sed -e"s+targets/${PLATFORM}/++" -e"s/.py//")
if [ ! -z "$START_TARGETS" ]; then
TARGETS="$START_TARGETS"
elif [ ! -z "$START_TARGET" ]; then
TARGETS="$START_TARGET"
else
TARGETS="$TARGET"
TARGETS=$(ls targets/${PLATFORM}/*.py | grep -v "__" | grep -v "$SKIP_TARGETS" | sed -e"s+targets/${PLATFORM}/++" -e"s/.py//")
fi
fi

if [ -z "$CPUS" ]; then
if [ -z "$CPU" ]; then
#CPUS="lm32 or1k riscv32"
CPUS="lm32"
else
CPUS="$CPU"
fi
fi
echo ""
echo ""
echo ""
Expand Down
43 changes: 43 additions & 0 deletions .travis/package-xilinx-cluefs-filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#! /usr/bin/env python

import os
import csv
import sys

with open(sys.argv[1]) as csvfile:
# 2017-10-15T09:24:17.147577188Z,2017-10-15T09:24:17.147595641Z,18453,tim,1001,tim,1001,/bin/ls,14308,/opt/Xilinx.real,dir,open,O_RDONLY,0000,4096,4096,1
reader = csv.DictReader(
csvfile,
fieldnames=(
"start_ts",
"end_ts",
"duration_ns", # nanoseconds
"user",
"uid",
"group",
"gid",
"process",
"pid",
"path",
"type"),
)

paths = set()
for l in reader:
#print(l)
#if l['type'] != 'file':
# continue
if not l['path'].startswith('/opt/Xilinx'):
continue
if not os.path.exists(l['path']):
continue
#if os.path.isdir(l['path']):
# continue

src = l['path']
dst = l['path'].replace('/opt/Xilinx.real/', '/opt/Xilinx/')

paths.add(dst)

for p in sorted(paths):
print(p)
44 changes: 44 additions & 0 deletions .travis/package-xilinx-step1-trace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

set -x
set -e

SETUP_SRC=$(realpath ${BASH_SOURCE[0]})
SETUP_DIR=$(dirname $SETUP_SRC)
TOP_DIR=$(realpath $SETUP_DIR/..)

BASE=$TOP_DIR/build/package-xilinx
echo $BASE
mkdir -p $BASE

export PREFIX="/opt/Xilinx/"

# This is based on https://github.com/m-labs/migen/blob/master/tools/strace_tailor.sh
if [ ! -z "$PLATFORMS" ]; then
echo "\$PLATFORMS is set to '$PLATFORMS', please unset it."
exit 1
fi
if [ ! -z "$TARGETS" ]; then
echo "\$TARGETS is set to '$TARGETS', please unset it."
exit 1
fi

(
echo "Deleting previous builds..."
cd build
# Delete all the previous builds
rm -rf *_*_*
)

STRACE_LOG=$BASE/strace.log
if [ -f $STRACE_LOG ]; then
echo "Deleting old strace log."
rm -v $STRACE_LOG
fi

# curl -L https://github.com/airnandez/cluefs/releases/download/v0.5/cluefs-v0.5-linux-x86_64.tar.gz | tar -xz
# https://github.com/airnandez/cluefs
# cluefs --mount=/opt/Xilinx --shadow=/opt/Xilinx.real --out=/tmp/Xilinx.log --ro --csv

#exec strace -e trace=file,process -E LD_LIBRARY_PATH=/opt/Xilinx/Vivado/2017.3/lib/lnx64.o -f -o ${STRACE_LOG}
bash $SETUP_DIR/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SETUP_SRC=$(realpath ${BASH_SOURCE[0]})
SETUP_DIR=$(dirname $SETUP_SRC)
TOP_DIR=$(realpath $SETUP_DIR/..)

for ARG in XILINX_PASSPHRASE_IN RACKSPACE_USER RACKSPACE_API; do
for ARG in XILINX_PASSPHRASE_IN; do
if [ -z "${!ARG}" ]; then
echo "$ARG not set"
exit 1
Expand All @@ -25,36 +25,36 @@ export PREFIX="/opt/Xilinx/"
# This is based on https://github.com/m-labs/migen/blob/master/tools/strace_tailor.sh
STRACE_LOG=$BASE/strace.log
if [ ! -f $STRACE_LOG ]; then
strace -e trace=file,process -f -o ${STRACE_LOG} bash $SETUP_DIR/build.sh
echo "No strace log found at $STRACE_LOG"
echo "Please run ./.travis/package-xilinx-step1-trace.sh"
exit 1
fi

STRACE_FILES=$BASE/strace.files.log
cat $STRACE_LOG | python $SETUP_DIR/package-xilinx-filter-strace.py $PREFIX > $STRACE_FILES
#cat $STRACE_LOG | python $SETUP_DIR/package-xilinx-filter-strace.py $PREFIX > $STRACE_FILES
$SETUP_DIR/package-xilinx-cluefs-filter.py $STRACE_LOG > $STRACE_FILES

XILINX_DIR=$BASE/xilinx-stripped
if [ -d $XILINX_DIR ]; then
rm -rf $XILINX_DIR
fi

echo ""
echo "Creating directories"
echo "--------------------------------------"
mkdir -p $XILINX_DIR
cat $STRACE_FILES | xargs -d '\n' \
cp --parents --no-dereference --preserve=all -t $XILINX_DIR
cp -v --parents --no-dereference --preserve=all -t $XILINX_DIR || true
echo "--------------------------------------"

FILENAME="$BASE/xilinx-ise-$(git describe).tar.bz2"
FILENAME="$BASE/xilinx-tools-$(git describe).tar.bz2"
echo $FILENAME
(
cd $XILINX_DIR
tar --preserve-permissions -jcvf $FILENAME opt
echo ""
echo "Creating tar file"
echo "--------------------------------------"
tar --preserve-permissions -jcvlf $FILENAME opt
echo "--------------------------------------"
)
echo $XILINX_PASSPHRASE_IN | gpg --passphrase-fd 0 --cipher-algo AES256 -c $FILENAME

(
cd $BASE
TB_COMMAND="turbolift -u $RACKSPACE_USER -a $RACKSPACE_API --os-rax-auth iad upload -c xilinx"

# Upload the tar bz
$TB_COMMAND -s . --sync --pattern-match ".*\.gpg"
# Upload the index file
md5sum *.gpg | sort -k2 > index.txt
$TB_COMMAND -s index.txt
)
33 changes: 33 additions & 0 deletions .travis/package-xilinx-step3-upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -x
set -e

SETUP_SRC=$(realpath ${BASH_SOURCE[0]})
SETUP_DIR=$(dirname $SETUP_SRC)
TOP_DIR=$(realpath $SETUP_DIR/..)

for ARG in RACKSPACE_USER RACKSPACE_API; do
if [ -z "${!ARG}" ]; then
echo "$ARG not set"
exit 1
else
echo "$ARG='${!ARG}'"
fi
done

BASE=$TOP_DIR/build/package-xilinx
echo $BASE
mkdir -p $BASE

(
cd $BASE
TB_COMMAND="turbolift --verbose --colorized -u $RACKSPACE_USER -a $RACKSPACE_API --os-rax-auth iad upload -c xilinx"

# Upload the tar bz
$TB_COMMAND -s . --sync --pattern-match ".*\.gpg"
# Upload the index file
md5sum *.gpg | sort -t- -k4,5n > index.txt
cat index.txt
$TB_COMMAND -s . --sync --pattern-match "index.txt"
)

0 comments on commit 89f5b66

Please sign in to comment.