====== Check out codes ======
===== Zynq software =====
<code bash>
nam@opt:ESQ $ svn co http://gauss.bu.edu/svn/g2-quad-pulser.firmware
nam@opt:ESQ $ mv g2-quad-pulser.firmware g2-quad-pulser.firmware.svn
nam@opt:g2-quad-pulser.firmware.svn $ cd carrier/trunk/os/software/
</code>
Make sure this is the latest version (as of 2020/10/05):
<code>
nam@opt:software $ svn info
Path: .
Working Copy Root Path: /home/nam/work/gm2/ESQ/g2-quad-pulser.firmware.svn
URL: http://gauss.bu.edu/svn/g2-quad-pulser.firmware/carrier/trunk/os/software
Relative URL: ^/carrier/trunk/os/software
Repository Root: http://gauss.bu.edu/svn/g2-quad-pulser.firmware
Repository UUID: 7ce3f3ac-83d5-4068-a32b-ab773f4188fc
Revision: 548
Node Kind: directory
Schedule: normal
Last Changed Author: dgastler
Last Changed Rev: 546
Last Changed Date: 2020-10-05 07:52:45 -0500 (Mon, 05 Oct 2020)
</code>
===== BUTool =====

<code bash>
nam@opt:software $ svn co http://gauss.bu.edu/svn/butool/trunk BUTool
nam@opt:BUTool $ svn info
...
Last Changed Rev: 70
Last Changed Date: 2019-09-17 10:35:07 -0500 (Tue, 17 Sep 2019)
</code>
Need to revert to ''r42'' which is compatible with Petalinux 2015.4
<code bash>
nam@opt:BUTool $ svn up -r42
nam@opt:BUTool $ svn info
Path: .
Working Copy Root Path: /home/nam/work/gm2/ESQ/g2-quad-pulser.firmware.svn/carrier/trunk/os/software/BUTool
URL: http://gauss.bu.edu/svn/butool/trunk
...
Last Changed Rev: 42
Last Changed Date: 2018-07-12 15:56:11 -0500 (Thu, 12 Jul 2018)
</code>

====== Build ======
===== BUTool =====
Run ''setup.sh'' to generate ''env.sh'' where all environment variables would be set. Also change the path to Petalinux to match the local installation.
<code bash>
nam@opt:BUTool $ PLATFORM=petalinux ./setup.sh
env.sh
Source env.sh and run 'make' to build BUTool
nam@opt:BUTool $ cat env.sh
if [[ $_ == $0 ]]; then
  echo "$0 is meant to be sourced:"
  echo "  source $0"
  exit 0
fi

export PLATFORM="petalinux"
export PREFIX="/work/butool"
export MAKEFLAGS="-I /home/nam/work/gm2/ESQ/g2-quad-pulser.firmware.svn/carrier/trunk/os/software/BUTool/mk"
export PROJECT_ROOT="/home/nam/work/gm2/ESQ/g2-quad-pulser.firmware.svn/carrier/trunk/os/software/BUTool"
export PATH="$PATH:/work/butool/bin"

export VIVADO_VERSION=2015.4
export VIVADO_SDK=/home/nam/Downloads/petalinux-v2015.4-final/settings.sh

source $VIVADO_SDK

export CXX=arm-xilinx-linux-gnueabi-g++
export CC=arm-xilinx-linux-gnueabi-gcc

export CROSS_HOST=arm-xilinx-linux-gnueabi

export MAKEOBJDIRPREFIX="$PROJECT_ROOT/obj"
export DESTDIR="$PROJECT_ROOT/install"

export BUTOOL_COMPILETIME_PATH="$DESTDIR/$PREFIX"
export BUTOOL_RUNTIME_PATH="$PREFIX"
</code>
Source ''env.sh'' and ''make'':
<code bash>
nam@opt:BUTool $ . env.sh
nam@opt:BUTool $ make
...
  CXX (link)  -o obj/lib/libBUTool.so
  CXX   src/tool/BUTool.cxx
  CXX (link)  -o obj/bin/BUTool
</code>
===== Zynq software =====
<code bash>
nam@opt:BUTool $ cd ../
nam@opt:software $ ./buildArm.sh
</code>
Need to change a few things
<code bash>
nam@opt:software $ svn diff
Index: buildArm.sh
===================================================================
--- buildArm.sh	(revision 548)
+++ buildArm.sh	(working copy)
@@ -15,7 +15,7 @@
 export PLATFORM=petalinux

 cd BUTool
-./setup.sh
+#./setup.sh
 source env.sh
 make clean
 make
Index: zynq_daq/Makefile
===================================================================
--- zynq_daq/Makefile	(revision 548)
+++ zynq_daq/Makefile	(working copy)
@@ -1,6 +1,9 @@
+SHELL := /bin/bash
 VIVADO_VERSION=2015.4
 #VIVADO_VERSION=2017.2
 VIVADO_SDK="/opt/Xilinx/SDK/"${VIVADO_VERSION}"/settings64.sh"
+VIVADO_SDK=/home/nam/Downloads/petalinux-v2015.4-final/settings.sh
+

 CXX=source ${VIVADO_SDK} && arm-xilinx-linux-gnueabi-g++
 #CXXFLAGS+=-c -g -O2 -Wall -Wextra -Werror -Wno-pointer-arith -I ./ -I ${G2FRAME_PREFIX}/include
Index: zynq_pl_bridge/Makefile
===================================================================
--- zynq_pl_bridge/Makefile	(revision 548)
+++ zynq_pl_bridge/Makefile	(working copy)
@@ -1,6 +1,7 @@

 VIVADO_VERSION=2015.4
 VIVADO_SDK="/opt/Xilinx/SDK/"$(VIVADO_VERSION)"/settings64.sh"
+VIVADO_SDK=/home/nam/Downloads/petalinux-v2015.4-final/settings.sh

 CXX=source $(VIVADO_SDK) && arm-xilinx-linux-gnueabi-g++
 CXXFLAGS+=-c -O2 -static -Wall -Wextra -Werror -Wno-pointer-arith
</code>