Remote access to Altera FPGA via jtagd in Linux

Hi All,

I just needed to program and debug my Altera FPGAs remotely. So I've prepared a small script on the remote machine:

#!/bin/bash killall jtagd killall jtagd sleep 1 echo I have killed the old server export PATH=/home/me/quartus/bin:$PATH sudo rmmod ppdev echo I have removed the ppdev driver sleep 2 sudo modprobe ppdev echo I've lodaed the ppdev driver sleep 2 jtagd echo I have run jtagd server sleep 4 echo Started server configuration jtagconfig --remove 1 jtagconfig --add byteblastermv lpt1 jtagconfig --enableremote my_password jtagconfig

Unfortunately the last command outputs the following:

1) ByteBlasterMV [/dev/parport0] 0100A0DD ! 020030DD ! 0100A0DD ! 020030DD !

Captured DR after reset = (0100A0DD020030DD0100A0DD020030DD) [128] Captured IR after reset = (5455554555) [40]

So the jtagd does not recognize the chips (probably it doesn't read the pgm_parts.txt file, when run in this mode) However the server is running and ready:

$netstat -l -t -p Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name [...] tcp 0 0 *:1309 *:* LISTEN

5444/jtagd [...]

When I run the jtagd with --user-start option (adding it in the proper line of the script), it correctly recognizes chips, but fails to enable remote access:

Started server configuration Error (Unknown error) when setting password

1) ByteBlasterMV [/dev/parport0] 0100A0DD EPC16/4/8 020030DD EP1S25/_HARDCOPY_FPGA_PROTOTYPE 0100A0DD EPC16/4/8 020030DD EP1S25/_HARDCOPY_FPGA_PROTOTYPE

now netstat returns: $ netstat -l -t -p Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name [...] tcp 0 0 localhost:1309 *:* LISTEN

5767/jtagd [...]

So jtagd listens only on the local machine. I tried to use ssh tunneling:

ssh snipped-for-privacy@remote.machine -L1309:localhost:1309

But then the local jtagd may not start, as 1309 port is occupied. Finally I've the solution, using the extended version of SSH tunneling:

ssh snipped-for-privacy@remote.machine -Laaa.bbb.ccc.ddd:1309:localhost:1309 (aaa.bbb.ccc.ddd - is the IP of my local machine, you can also create a fake additional IP with "ifconfig eth0:1 aaa.bbb.ccc.ddd up" using an unrouteable IP)

Now the local jtagd connects to the localhost 1309 port, while tunneled remote jtagd listens on the aaa.bbb.ccc.ddd 1309 port. If you now locally run $ qrt_path/jtagd --user-start $ qrt_path/jtagconfig --addserver aaa.bbb.ccc.ddd e ("e" is a dummy password, not used, but needed) $ qrt_path/bin/jtagconfig

1) ByteBlasterMV on aaa.bbb.ccc.ddd [/dev/parport0] 0100A0DD EPC16/4/8 020030DD EP1S25/_HARDCOPY_FPGA_PROTOTYPE 0100A0DD EPC16/4/8 020030DD EP1S25/_HARDCOPY_FPGA_PROTOTYPE

BTW This method should provide better security. I know nothing about the security of Altera remote jtagd protocol. It seems (from ethereal dumps) that it doesn't send passwords as plaintext, but I don't know how easy it is to break. In the above method you connect via the proven SSH protocol.

So my final script "~/jtagstart" looks like this:

#!/bin/bash killall jtagd killall jtagd sleep 1 echo I have killed the old server export PATH=/home/me/quartus/bin:$PATH sudo rmmod ppdev echo I have removed the ppdev driver sleep 2 sudo modprobe ppdev echo I have lodaed the ppdev driver sleep 2 jtagd --user-start echo I have run jtagd server sleep 4 echo Started server configuration jtagconfig --remove 1 jtagconfig --add byteblastermv lpt1 jtagconfig

You should run on the local machine: $ssh snipped-for-privacy@remote.machine -Laaa.bbb.ccc.ddd:1309:localhost:1309 /home/me/jtagstart and then locally: $ qrt_path/jtagd --user-start $ qrt_path/jtagconfig --addserver aaa.bbb.ccc.ddd e

Works like a dream :-).

HTH & Regards Wojtek Zabolotny

Reply to
Wojciech Zabolotny
Loading thread data ...

In the script from the previous post, when script finishes, the tunnel disappears and connection is broken :-(. So you either must ssh to the command prompt:

$ssh snipped-for-privacy@remote.machine -Laaa.bbb.ccc.ddd:1309:localhost:1309

and then run the jtagstart manually:

$./jtagstart

The session will be active until you logout with exit. Or you should add a never ending loop at the end of the script, e.g. like this: while true; do echo tunnel active sleep 1m done

--
Sorry for confusion,
wojtek
Reply to
Wojciech Zabolotny

Hi comp.arch.fpga, Wojciech,

I have figured out how to get jtagd working in Remote mode *with* correct detection of part names ("071280DD" --> "EPM7128S").

Here's what you need to do:

  1. If there's an already-running instance of jtagd, kill it: killall jtagd
  2. mkdir /etc/jtagd
  3. Create /etc/jtagd/jtagd.conf using the following template. Use the ~/.jtagd.conf file, generated by jtagconfig, for inspiration, particularly for the Device sections. # /etc/jtagd/jtagd.conf

Password = "changeme";

Device0 { Port = "/dev/parport0"; Type = "ByteBlasterII"; }

  1. Provide the part name database to jtagd. For some reason, it looks for it as /etc/jtagd/jtagd.pgm_parts when --user-start is *not* specified. You can either make a symbolic link or copy it: /etc/jtagd# ln -s $QUARTUS_HOME/linux/pgm_parts.txt jtagd.pgm_parts
  2. Start jtagd manually, using only the --config switch: $QUARTUS_HOME/bin/jtagd --config /etc/jtagd/jtagd.conf

At this point, jtagd will be listening on *:1309 and will accept remote connections provided the password is correct. The parts will also show up using their names instead of JTAG IDs only. I have programmed a EPM7128S from Quartus II 5.0 Windows using this and it worked well.

If you run into any trouble, add in the --foreground --debug switches.

Enjoy.

Catalin

Reply to
Catalin Patulea (eigma)

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.