Difference between revisions of "Installing OpenOCD"

From spiderboard.org
Jump to: navigation, search
(Created page with "= From APT = If your distributor provides OpenOCD (version 0.10 or higher, with ftdi-usb-blaster interface) it is sufficient to run in a terminal: : $ sudo apt install openoc...")
 
Line 1: Line 1:
= From APT =
+
== Installing OpenOCD ==
  
If your distributor provides OpenOCD (version 0.10 or higher, with ftdi-usb-blaster interface) it is sufficient to run in a terminal:
+
* OpenOCD Version >= 0.10 with the libftdi driver is required.
: $ sudo apt install openocd
+
* If your package distributor provides this version, use your package manager to install OpenOCD:
 +
* For Debian based distributions the terminal command is:
 +
*: '''$''' sudo apt install openocd
 +
* If the package version does not work, it is possible to compile OpenOCD from [https://github.com/ntfreak/openocd source].
  
These distributions have OpenOCD 0.10 available:
+
== Shell Script For Easier Use ==
  
* Linux Mint 19.1
+
A shell script can be used that starts OpenOCD, runs the svf file and shuts down afterwards, allowing conveniently programming the FPGA using a single terminal command.
* Ubuntu 18.04
 
  
= From Source =
+
* Create the file '''mx10spider_prog''' under ''.local/bin'' in your home directory and insert the content below.
 +
* If not already done, add ''.local/bin'' to the path variable.
 +
** Open .profile in your home directory with a text editor and add the line:
 +
**: PATH=".local/bin:$PATH"
 +
* Open a terminal and add the executable flag.
 +
*: '''$''' chmod +x .local/bin/mx10spider_prog
 +
* You are now ready to progrmm the fpga using the command:
 +
*: '''$''' mx10spider_prog  ''<path/to/file.svf>''
  
If the APT version of OpenOCD does not work, it can be compiled from [https://github.com/ntfreak/openocd source].
+
<br>
 +
 
 +
'''mx10spider_prog:'''
 +
<nowiki>
 +
#!/bin/sh
 +
 
 +
me=$(basename $0)
 +
 
 +
if [ -f "$1" ]; then
 +
 
 +
    openocd -c "interface usb_blaster" -c "usb_blaster_lowlevel_driver ftdi" -c "usb_blaster_vid_pid 0x04d8 0xefd0" -c "jtag newtap max10 tap -irlen 10 -expected-id 0x31810dd -expected-id 0x318a0dd \
 +
-expected-id 0x31820dd -expected-id 0x31830dd -expected-id 0x31840dd \
 +
-expected-id 0x318d0dd -expected-id 0x31850dd -expected-id 0x31010dd \
 +
-expected-id 0x310a0dd -expected-id 0x31020dd -expected-id 0x31030dd \
 +
-expected-id 0x31040dd -expected-id 0x310d0dd -expected-id 0x31050dd" -c "init" -c "svf $1 progress" -c "shutdown"
 +
 
 +
elif [ "$1" = "" ]; then
 +
 
 +
echo "\tError: No file specified.\n\tUsage: $me <file.svf>"
 +
 
 +
elif [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
 +
 
 +
echo "\tUtility script to start openocd and run an svf file.\n\tUsage: $me <file.svf>"
 +
 
 +
else
 +
 
 +
    echo "\tFile not found: $1\n\tUsage: $me <file.svf>"
 +
 
 +
fi
 +
</nowiki>

Revision as of 12:34, 21 May 2019

Installing OpenOCD

  • OpenOCD Version >= 0.10 with the libftdi driver is required.
  • If your package distributor provides this version, use your package manager to install OpenOCD:
  • For Debian based distributions the terminal command is:
    $ sudo apt install openocd
  • If the package version does not work, it is possible to compile OpenOCD from source.

Shell Script For Easier Use

A shell script can be used that starts OpenOCD, runs the svf file and shuts down afterwards, allowing conveniently programming the FPGA using a single terminal command.

  • Create the file mx10spider_prog under .local/bin in your home directory and insert the content below.
  • If not already done, add .local/bin to the path variable.
    • Open .profile in your home directory with a text editor and add the line:
      PATH=".local/bin:$PATH"
  • Open a terminal and add the executable flag.
    $ chmod +x .local/bin/mx10spider_prog
  • You are now ready to progrmm the fpga using the command:
    $ mx10spider_prog <path/to/file.svf>


mx10spider_prog:

#!/bin/sh

me=$(basename $0)

if [ -f "$1" ]; then

    openocd -c "interface usb_blaster" -c "usb_blaster_lowlevel_driver ftdi" -c "usb_blaster_vid_pid 0x04d8 0xefd0" -c "jtag newtap max10 tap -irlen 10 -expected-id 0x31810dd -expected-id 0x318a0dd \
	-expected-id 0x31820dd -expected-id 0x31830dd -expected-id 0x31840dd \
	-expected-id 0x318d0dd -expected-id 0x31850dd -expected-id 0x31010dd \
	-expected-id 0x310a0dd -expected-id 0x31020dd -expected-id 0x31030dd \
	-expected-id 0x31040dd -expected-id 0x310d0dd -expected-id 0x31050dd" -c "init" -c "svf $1 progress" -c "shutdown"

elif [ "$1" = "" ]; then

	echo "\tError: No file specified.\n\tUsage: $me <file.svf>"

elif [ "$1" = "-h" ] || [ "$1" = "--help" ]; then

	echo "\tUtility script to start openocd and run an svf file.\n\tUsage: $me <file.svf>"

else

    echo "\tFile not found: $1\n\tUsage: $me <file.svf>"

fi