aboutsummaryrefslogtreecommitdiffstats
path: root/fpga/.ci/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'fpga/.ci/scripts')
-rw-r--r--fpga/.ci/scripts/refresh_ip.sh38
-rw-r--r--fpga/.ci/scripts/run_setup.sh43
2 files changed, 81 insertions, 0 deletions
diff --git a/fpga/.ci/scripts/refresh_ip.sh b/fpga/.ci/scripts/refresh_ip.sh
new file mode 100644
index 000000000..f4e37bf5b
--- /dev/null
+++ b/fpga/.ci/scripts/refresh_ip.sh
@@ -0,0 +1,38 @@
+#
+# Copyright 2022 Ettus Research, a National Instruments Brand
+#
+# SPDX-License-Identifier: LGPL-3.0-or-later
+#
+# Description:
+#
+# This script first refreshes a given build IP directory to the current time
+# (assume all the IP files within that directory were just built) and then
+# the script touches all the files that changed between the current repo's
+# working tree and a given hash (used to build IP).
+# This allows the user to download pre-built IP (e.g. cached) and re-build
+# only those IP components that changed in between the cached commit and the
+# current working tree.
+#
+# Arguments:
+#
+# $1 = absolute path to build-ip/ directory
+# $2 = git hash used to build IP in $1
+#
+# Example:
+#
+# bash .refresh_ip.sh `realpath path/to/build-ip` 1234abc
+#
+
+# # Step 1: refresh build-ip/ directory to current time
+echo "[refresh_ip.sh] Resetting timestamp for files in $1"
+find $1 -type f -exec touch --no-create {} +
+
+# # Step 2: determine all files that changed and update their time (dirty)
+echo "[refresh_ip.sh] Differences between $2 and working tree (marked dirty):"
+git diff --line-prefix=`git rev-parse --show-toplevel`/ --name-only $2 | \
+ while read -r line; do \
+ if [[ $line == *"ip/"* ]]; then \
+ echo " $line"; \
+ touch --no-create $line; \
+ fi \
+ done
diff --git a/fpga/.ci/scripts/run_setup.sh b/fpga/.ci/scripts/run_setup.sh
new file mode 100644
index 000000000..c70fd5702
--- /dev/null
+++ b/fpga/.ci/scripts/run_setup.sh
@@ -0,0 +1,43 @@
+#
+# Copyright 2022 Ettus Research, a National Instruments Brand
+#
+# SPDX-License-Identifier: LGPL-3.0-or-later
+#
+# Description:
+#
+# Script to run NI hwsetup and UHD setupenv for the target build. Always
+# source this file.
+#
+# Arguments:
+#
+# $1 = Directory where setupenv is located
+#
+# Example:
+#
+# source run_setup.sh ./usrp3/top/x400
+#
+
+set -e
+
+echo "---- Set environment variables ----"
+export path_hwtools=$BUILD_SOURCESDIRECTORY/hwtools/head/setup
+export PATH=$path_hwtools:$PATH
+
+echo "---- Run hwsetup ----"
+# This script sets the XILINX_VIVADO, MODELSIM, and LIB_BASE_PATH
+# variables based on the agent's configuration so we can find the EDA
+# tools.
+pushd $BUILD_SOURCESDIRECTORY/uhddev/fpga/.ci/hwtools
+source hwsetup.sh
+popd
+
+echo "---- Install Vivado patches ----"
+pushd $BUILD_SOURCESDIRECTORY
+wget -q $PATCHES_PATH/2019.1/AR73068_Vivado_2019_1_preliminary_rev1.zip -O ./AR73068_Vivado_2019_1_preliminary_rev1.zip
+unzip -q -o AR73068_Vivado_2019_1_preliminary_rev1.zip -d ./patch/
+export XILINX_PATH=$PWD/patch/vivado
+popd
+
+echo "---- Run setupenv ----"
+export MSIM_VIV_COMPLIBDIR=$LIB_BASE_PATH/vivado/2019.1.1/modelsim_SE-64_2020
+source $1/setupenv.sh --vivado-path $(dirname $XILINX_VIVADO) --modelsim-path $(dirname $MODELSIM)