Version 18, changed by grante. 11/01/2006. Show version history
#!/bin/sh # USB-Blaster hotplug script # Allow any user to access the cable chmod 666 $DEVICE
# # Altera USB-Blaster # usbblaster 0x03 0x09fb 0x6001 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 usbblaster 0x03 0x09fb 0x6002 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 usbblaster 0x03 0x09fb 0x6003 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
The NIOS2 gdb server doesn't talk directory to the USB Blaster cable. The jtagd daemon is the program that actually talks to the USB Blaster. jtagd listens on localhost port 1309 for connections from applications such as nios2-gdb-server-wrapped and jtagconfig. The jtagconfig program isn't actually required, but it's handy for making sure that the USB Blaster cable and target hardware are functioning.
What's important is that jtagd must be running before jtagconfig or nios2-gdb-server-wrapped can be used.
-rwxr-xr-x 1 grante users 29296 Oct 20 2005 jtagconfig -rwxr-xr-x 1 grante users 340120 Oct 28 22:51 jtagd -rw-r--r-- 1 grante users 62452 Oct 30 13:52 jtagd.pgm_parts -rwxr-xr-x 1 grante users 15440 Oct 28 22:51 libccl_ver.so -rwxr-xr-x 1 grante users 182208 Oct 28 21:55 libjtag_client.so -rwxr-xr-x 1 grante users 145229 Oct 28 21:55 nios2-gdb-server-wrappedThe file jtagd.pgm_parts needs to be in /etc/jtagd. I leave the rest of the files in a single directory.
#!/bin/bash
test -f ~/.jtag.conf ||
{
echo "you don't have a $HOME/.jtag.conf file. Creating an empty one"
touch ~/.jtag.conf
}
for f in jtagd nios2-gdb-server-wrapped jtagconfig libccl_ver.so libjtag_client.so
do
test -f $f || { echo "$f must be in this directory"; exit 1; }
done
test -f /etc/jtagd/jtagd.pgm_parts ||
{
echo -"/etc/jtagd/jtagd.pgm_parts file is missing. Attempting to create one..."
test -d /etc/jtagd || mkdir --verbose /etc/jtagd
cp --verbose jtagd.pgm_parts /etc/jtagd
echo "OK"
}
(grep -q usbblaster /etc/hotplug/usb.usermap && test -f /etc/hotplug/usb/usbblaster) ||
{
echo "missing config in /etc/hotplug/usb.usermap -- please see usbblaster.readme"
exit 0
}
export LD_LIBRARY_PATH=$PWD
set -x
./jtagd
./jtagconfig
exec ./nios2-gdb-server-wrapped --tcpport 8888 --tcppersist
$ ./gdb-server.sh + ./jtagd + ./jtagconfig 1) USB-Blaster [USB 4-1.1] 020B30DD EP2C20 020A10DD EPM240 + exec ./nios2-gdb-server-wrapped --tcpport 8888 --tcppersist Using cable "USB-Blaster [USB 4-1.1]", device 1, instance 0x00 Processor is already paused Listening on port 8888 for connection from GDB:
$ nios2-elf-gdb GNU gdb 6.1 Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i686-pc-linux-gnu --target=nios2-elf". (gdb) target remote localhost:8888 Remote debugging using localhost:8888 0x08000000 in ?? () (gdb)