From b3e8dfd2ac678ebf25d0744a65979b3c90c0461b Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Mon, 21 Apr 2014 13:28:37 -0700 Subject: UHD: Updating README in tools/ directory. --- tools/README | 31 ------- tools/README.md | 22 +++++ tools/usrp_x3xx_fpga_jtag_programmer.sh | 148 ++++++++++++++++++++++++++++++++ 3 files changed, 170 insertions(+), 31 deletions(-) delete mode 100644 tools/README create mode 100644 tools/README.md create mode 100755 tools/usrp_x3xx_fpga_jtag_programmer.sh (limited to 'tools') diff --git a/tools/README b/tools/README deleted file mode 100644 index 7c23a1fff..000000000 --- a/tools/README +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright 2014 Ettus Research LLC -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - - -UHD Tools -========= - -This folder contains tools which might be useful when debugging or -working on USRPs. None of these tools actually require UHD to be installed! - - -List of tools: -------------- - -impact_jtag_programmer.sh - Program the X3x0 FPGA via JTAG. Requires Xilinx iMPACT. - - diff --git a/tools/README.md b/tools/README.md new file mode 100644 index 000000000..d58577589 --- /dev/null +++ b/tools/README.md @@ -0,0 +1,22 @@ +USRP™ Tools +============================ + +This folder contains tools that are useful for working with and/or debugging +your USRP™ device. Tools in this directory do **not** link against UHD. They are +either stand-alone programs or software to be used in third-party applications. + +For UHD™ software tools, look in `uhd/host/utils`. + + +## List of Tools + +__usrp_x3xx_fpga_jtag_programmer.sh__ + +This tool is to be used with the USRP™ X300 and X310 devices. It allows you to +program the X3x0 FPGA via JTAG. Note that loading the FPGA image via JTAG does +**not** store the FPGA in the on-device flash storage. Thus, as soon as you +cycle power, the image will be lost. To permanently burn an FPGA image, please +refer to `uhd/host/utils/usrp_x3xx_fpga_burner`. + +This tool requires that Xilinx iMPACT has been installed on your system. + diff --git a/tools/usrp_x3xx_fpga_jtag_programmer.sh b/tools/usrp_x3xx_fpga_jtag_programmer.sh new file mode 100755 index 000000000..df563da14 --- /dev/null +++ b/tools/usrp_x3xx_fpga_jtag_programmer.sh @@ -0,0 +1,148 @@ +#!/bin/bash +# + +### Helper functions ########################################## +function help { + cat <] --fpga-path= + +-h - Shows this. +--impact-path - Path to the iMPACT binary (if not already in PATH). + Often something like /opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/impact +--fpga-path - Path to the FPGA image. +--nipcie - When this option is set, this script will fail if it was unable + to stop the NI RIO USRP PCIe driver. + +This script uses Xilinx iMPACT to reprogram the FPGA through the USB JTAG connector. +You can use this to unbrick USRP X3x0 devices. + +EOHELP +} + +### Go, go, go! ############################################### +echo "=======================================" +echo " Copyright 2014 Ettus Research LLC" +echo "" +echo " JTAG Programming Tool" +echo "=======================================" +echo "" + +IMPACTPATH="impact" # This'll work if impact is in $PATH +FPGAIMG="" +FORCENIPCIECHECK=0 + +# Go through cmd line options +for i in "$@" +do +case $i in + -h|--help) + help + exit + ;; + --impact-path=*) + IMPACTPATH="${i#*=}" + ;; + --fpga-path=*) + FPGAIMG="${i#*=}" + ;; + --nipcie) + FORCENIPCIECHECK=1 + ;; + *) + echo Unrecognized option: $i + echo + help + exit + break + ;; +esac +done + +# Test impact binary is available +IMPACTEXECUTABLE=`which $IMPACTPATH` +if [ ! $? -eq 0 ]; then + echo "ERROR: Cannot find 'impact' executable. Make sure you have iMPACT installed" + echo "and that it is in your PATH, or use the --impact-path option to provide the" + echo "location of the 'impact' executable." + exit 1 +fi + +# Test the FPGA image file is readable +if [ -z $FPGAIMG ]; then + echo "ERROR: No FPGA image file provided." + exit 1 +fi +if [ ! -r $FPGAIMG ]; then + echo "ERROR: Can't read the FPGA image file ($FPGAIMG)." + exit 1 +fi + +# Test if we need to stop PCIe +NIUSRPRIOPCIE=`which niusrprio_pcie` +HASNIUSRPRIOPCIE=$? +if [ ! $HASNIUSRPRIOPCIE -eq 0 -a $FORCENIPCIECHECK -eq 1 ]; then + echo "ERROR: Cannot find the niusrprio_pcie executable. Make sure it is in your PATH." + exit 1 +fi + +NIUSRPRIOWASLOADED=0 +# If we do, check if we can run niusrprio_pcie +if [ $HASNIUSRPRIOPCIE -eq 0 ]; then + NIUSRPRIOSTATUSOUTPUT=`niusrprio_pcie status` + NIUSRPRIORETVAL=$? + if [ ! $NIUSRPRIORETVAL -eq 0 ]; then + echo "ERROR: Can't run 'niusrprio_pcie status'. Maybe you forgot to use sudo?" + exit $NIUSRPRIORETVAL + fi + NIUSRPRIOSTATUSOUTPUTGREP=`niusrprio_pcie status | grep usrp` + if [ ! -z "$NIUSRPRIOSTATUSOUTPUTGREP" ]; then + NIUSRPRIOWASLOADED=1 + fi +fi +if [ $NIUSRPRIOWASLOADED -eq 1 ]; then + echo "==== Stopping nisurprio drivers... " + niusrprio_pcie stop + NIUSRPRIORETVAL=$? + if [ ! $NIUSRPRIORETVAL -eq 0 ]; then + echo "ERROR: Can't run 'niusrprio_pcie stop'. Maybe you forgot to use sudo?" + exit $NIUSRPRIORETVAL + else + echo "Done." + fi +fi + +# Create batch file +CMD_PATH=`mktemp XXXXXXXX.impact.cmd` +echo "==== Generating impact batch file ${CMD_PATH}..." +echo "setmode -bscan" > ${CMD_PATH} +echo "setcable -p auto" >> ${CMD_PATH} +echo "addDevice -p 1 -file ${FPGAIMG}" >> ${CMD_PATH} +echo "program -p 1" >> ${CMD_PATH} +echo "quit" >> ${CMD_PATH} + +# Run impact +echo "==== Running impact -- loading ${FPGAIMG} into the FPGA..." +${IMPACTEXECUTABLE} -batch ${CMD_PATH} +RETVAL=$? +if [ ! $RETVAL -eq 0 ]; then + echo "ERROR: Programming failed. Check output above for hints. Maybe you forgot to use sudo?" +else + echo "==== Programming complete! ==============" +fi + +# Remove batch file +rm $CMD_PATH +if [ $NIUSRPRIOWASLOADED -eq 1 ]; then + echo "==== Re-starting nisurprio drivers... " + niusrprio_pcie start + NIUSRPRIORETVAL=$? + if [ ! $NIUSRPRIORETVAL -eq 0 ]; then + echo "WARNING: nisusrprio drivers were running before, but could not be reloaded after flashing." + echo "This is usually not a problem with the FPGA image burning." + fi +fi + +exit $RETVAL + +# C'est tout -- cgit v1.2.3 From 73e55158771f3ee9db467d748790773f0b3f11ab Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Mon, 21 Apr 2014 13:29:55 -0700 Subject: uhd tools: removing old impact programmer (it has been renamed) --- tools/impact_jtag_programmer.sh | 148 ---------------------------------------- 1 file changed, 148 deletions(-) delete mode 100755 tools/impact_jtag_programmer.sh (limited to 'tools') diff --git a/tools/impact_jtag_programmer.sh b/tools/impact_jtag_programmer.sh deleted file mode 100755 index df563da14..000000000 --- a/tools/impact_jtag_programmer.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/bash -# - -### Helper functions ########################################## -function help { - cat <] --fpga-path= - --h - Shows this. ---impact-path - Path to the iMPACT binary (if not already in PATH). - Often something like /opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/impact ---fpga-path - Path to the FPGA image. ---nipcie - When this option is set, this script will fail if it was unable - to stop the NI RIO USRP PCIe driver. - -This script uses Xilinx iMPACT to reprogram the FPGA through the USB JTAG connector. -You can use this to unbrick USRP X3x0 devices. - -EOHELP -} - -### Go, go, go! ############################################### -echo "=======================================" -echo " Copyright 2014 Ettus Research LLC" -echo "" -echo " JTAG Programming Tool" -echo "=======================================" -echo "" - -IMPACTPATH="impact" # This'll work if impact is in $PATH -FPGAIMG="" -FORCENIPCIECHECK=0 - -# Go through cmd line options -for i in "$@" -do -case $i in - -h|--help) - help - exit - ;; - --impact-path=*) - IMPACTPATH="${i#*=}" - ;; - --fpga-path=*) - FPGAIMG="${i#*=}" - ;; - --nipcie) - FORCENIPCIECHECK=1 - ;; - *) - echo Unrecognized option: $i - echo - help - exit - break - ;; -esac -done - -# Test impact binary is available -IMPACTEXECUTABLE=`which $IMPACTPATH` -if [ ! $? -eq 0 ]; then - echo "ERROR: Cannot find 'impact' executable. Make sure you have iMPACT installed" - echo "and that it is in your PATH, or use the --impact-path option to provide the" - echo "location of the 'impact' executable." - exit 1 -fi - -# Test the FPGA image file is readable -if [ -z $FPGAIMG ]; then - echo "ERROR: No FPGA image file provided." - exit 1 -fi -if [ ! -r $FPGAIMG ]; then - echo "ERROR: Can't read the FPGA image file ($FPGAIMG)." - exit 1 -fi - -# Test if we need to stop PCIe -NIUSRPRIOPCIE=`which niusrprio_pcie` -HASNIUSRPRIOPCIE=$? -if [ ! $HASNIUSRPRIOPCIE -eq 0 -a $FORCENIPCIECHECK -eq 1 ]; then - echo "ERROR: Cannot find the niusrprio_pcie executable. Make sure it is in your PATH." - exit 1 -fi - -NIUSRPRIOWASLOADED=0 -# If we do, check if we can run niusrprio_pcie -if [ $HASNIUSRPRIOPCIE -eq 0 ]; then - NIUSRPRIOSTATUSOUTPUT=`niusrprio_pcie status` - NIUSRPRIORETVAL=$? - if [ ! $NIUSRPRIORETVAL -eq 0 ]; then - echo "ERROR: Can't run 'niusrprio_pcie status'. Maybe you forgot to use sudo?" - exit $NIUSRPRIORETVAL - fi - NIUSRPRIOSTATUSOUTPUTGREP=`niusrprio_pcie status | grep usrp` - if [ ! -z "$NIUSRPRIOSTATUSOUTPUTGREP" ]; then - NIUSRPRIOWASLOADED=1 - fi -fi -if [ $NIUSRPRIOWASLOADED -eq 1 ]; then - echo "==== Stopping nisurprio drivers... " - niusrprio_pcie stop - NIUSRPRIORETVAL=$? - if [ ! $NIUSRPRIORETVAL -eq 0 ]; then - echo "ERROR: Can't run 'niusrprio_pcie stop'. Maybe you forgot to use sudo?" - exit $NIUSRPRIORETVAL - else - echo "Done." - fi -fi - -# Create batch file -CMD_PATH=`mktemp XXXXXXXX.impact.cmd` -echo "==== Generating impact batch file ${CMD_PATH}..." -echo "setmode -bscan" > ${CMD_PATH} -echo "setcable -p auto" >> ${CMD_PATH} -echo "addDevice -p 1 -file ${FPGAIMG}" >> ${CMD_PATH} -echo "program -p 1" >> ${CMD_PATH} -echo "quit" >> ${CMD_PATH} - -# Run impact -echo "==== Running impact -- loading ${FPGAIMG} into the FPGA..." -${IMPACTEXECUTABLE} -batch ${CMD_PATH} -RETVAL=$? -if [ ! $RETVAL -eq 0 ]; then - echo "ERROR: Programming failed. Check output above for hints. Maybe you forgot to use sudo?" -else - echo "==== Programming complete! ==============" -fi - -# Remove batch file -rm $CMD_PATH -if [ $NIUSRPRIOWASLOADED -eq 1 ]; then - echo "==== Re-starting nisurprio drivers... " - niusrprio_pcie start - NIUSRPRIORETVAL=$? - if [ ! $NIUSRPRIORETVAL -eq 0 ]; then - echo "WARNING: nisusrprio drivers were running before, but could not be reloaded after flashing." - echo "This is usually not a problem with the FPGA image burning." - fi -fi - -exit $RETVAL - -# C'est tout -- cgit v1.2.3 From dd57b58d6591c54dbb23b3224477dd24c3d2d0a2 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Mon, 21 Apr 2014 13:52:10 -0700 Subject: UHD tools: improving READMEs, fixing licenses. --- tools/README.md | 11 +++++++++++ tools/uhd_dump/Makefile | 18 ++++++++++++++++-- tools/uhd_dump/chdr_log.c | 17 +++++++++++++++++ tools/uhd_dump/uhd_dump.c | 16 ++++++++++++++++ tools/uhd_dump/uhd_dump.h | 18 ++++++++++++++++-- tools/uhd_dump/usrp3_regs.h | 16 ++++++++++++++++ 6 files changed, 92 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/README.md b/tools/README.md index d58577589..cdd4bcba8 100644 --- a/tools/README.md +++ b/tools/README.md @@ -10,6 +10,17 @@ For UHD™ software tools, look in `uhd/host/utils`. ## List of Tools +__chdr-dissector/__ + +This is a packet dissector for [Wireshark](http://www.wireshark.org/). It allows +you to view the details of a Compressed HeaDeR (CHDR) formatted-packet in +Wireshark. The USRP™ B2xx and X3xx use the CHDR format. + +__uhd_dump/__ + +This tool can be used with `tcpdump` to make sense of packet dumps from your +network-connected USRP™ device. + __usrp_x3xx_fpga_jtag_programmer.sh__ This tool is to be used with the USRP™ X300 and X310 devices. It allows you to diff --git a/tools/uhd_dump/Makefile b/tools/uhd_dump/Makefile index 93181570b..b793776d4 100644 --- a/tools/uhd_dump/Makefile +++ b/tools/uhd_dump/Makefile @@ -1,12 +1,26 @@ +# Copyright 2013-2014 Ettus Research LLC +# +# GNU Radio is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3, or (at your option) any later version. +# +# GNU Radio 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# GNU Radio; see the file COPYING. If not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA. + INCLUDES = usrp3_regs.h uhd_dump.h BINARIES = chdr_log -OBJECTS = uhd_dump.o +OBJECTS = uhd_dump.o CFLAGS = -g -O0 -Wall -LDFLAGS = -lpcap -lm +LDFLAGS = -lpcap -lm CC = cc diff --git a/tools/uhd_dump/chdr_log.c b/tools/uhd_dump/chdr_log.c index 9a0834e9b..77473b895 100644 --- a/tools/uhd_dump/chdr_log.c +++ b/tools/uhd_dump/chdr_log.c @@ -1,3 +1,20 @@ +// +// Copyright 2013-2014 Ettus Research LLC +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + #include #include #include diff --git a/tools/uhd_dump/uhd_dump.c b/tools/uhd_dump/uhd_dump.c index 3238d72cf..833eca911 100644 --- a/tools/uhd_dump/uhd_dump.c +++ b/tools/uhd_dump/uhd_dump.c @@ -1,3 +1,19 @@ +// +// Copyright 2013-2014 Ettus Research LLC +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// #include #include diff --git a/tools/uhd_dump/uhd_dump.h b/tools/uhd_dump/uhd_dump.h index 2c36f9a39..3a6ac4ef1 100644 --- a/tools/uhd_dump/uhd_dump.h +++ b/tools/uhd_dump/uhd_dump.h @@ -1,9 +1,23 @@ +// +// Copyright 2013-2014 Ettus Research LLC +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// #ifndef _UHD_DUMP_H_ #define _UHD_DUMP_H_ - - #define FALSE 0 #define TRUE 1 #define UNKNOWN 2 diff --git a/tools/uhd_dump/usrp3_regs.h b/tools/uhd_dump/usrp3_regs.h index 5e3fc1cac..4ec147b52 100644 --- a/tools/uhd_dump/usrp3_regs.h +++ b/tools/uhd_dump/usrp3_regs.h @@ -1,3 +1,19 @@ +// +// Copyright 2013-2014 Ettus Research LLC +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// const struct radio_ctrl_names reg_list[] = { -- cgit v1.2.3