Difference between revisions of "Installing OpenOCD"
From spiderboard.org
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | == Installing OpenOCD == | + | == Installing OpenOCD (Linux) == |
* OpenOCD Version >= 0.10 with the libftdi driver is required. | * OpenOCD Version >= 0.10 with the libftdi driver is required. | ||
Line 7: | Line 7: | ||
* If the package version does not work, it is possible to compile OpenOCD from [https://github.com/ntfreak/openocd source (github)]. | * If the package version does not work, it is possible to compile OpenOCD from [https://github.com/ntfreak/openocd source (github)]. | ||
− | == Shell Script For Easier Use == | + | == Installing OpenOCD (Windows) == |
+ | |||
+ | * OpenOCD Version >= 0.10 with the libftdi driver is required. | ||
+ | * Prebuild binaries can be downloaded from [https://github.com/gnu-mcu-eclipse/openocd/releases GNU MCU Eclipse] | ||
+ | * The .zip file can be unpacked to any location | ||
+ | * Install the libusbK driver for the JTAG interface | ||
+ | ** Download and start [https://zadig.akeo.ie/ Zadig] | ||
+ | ** Select ''MX10/Spider JTAG (Interface 0)'' and ''libusbK driver'' and click Install Driver. | ||
+ | |||
+ | <div><ul> | ||
+ | <li style="display: inline-block;"> [[File:Zadig.png|x200px|thumb]] </li> | ||
+ | </ul></div> | ||
+ | |||
+ | == Shell Script For Easier Use (Linux) == | ||
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. | 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 ''' | + | * Create the file '''mx10spider''' under ''.local/bin'' in your home directory and insert the content below. |
* If not already done, add ''.local/bin'' to the path variable. | * 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: | ** Open ''.profile'' in your home directory with a text editor and add the line: | ||
Line 18: | Line 31: | ||
**: '''$''' source ~/.profile | **: '''$''' source ~/.profile | ||
* Open a terminal and add the executable flag. | * Open a terminal and add the executable flag. | ||
− | *: '''$''' chmod +x .local/bin/ | + | *: '''$''' chmod +x .local/bin/mx10spider |
* You are now ready to program the fpga using the command: | * You are now ready to program the fpga using the command: | ||
− | *: '''$''' | + | *: '''$''' mx10spider ''<path/to/file.svf>'' |
* If your project is for example located under ''/opt/quartus_projects/Example'', use one of the following commands: | * If your project is for example located under ''/opt/quartus_projects/Example'', use one of the following commands: | ||
− | *: '''$''' | + | *: '''$''' mx10spider /opt/quartus_projects/Example/output_files/Example.svf |
− | *: '''$''' | + | *: '''$''' mx10spider /opt/quartus_projects/Example/output_files/Example_pof.svf |
*: for programming the .sof or .pof file respectively. | *: for programming the .sof or .pof file respectively. | ||
<br> | <br> | ||
− | ''' | + | '''mx10spider:''' |
<nowiki> | <nowiki> | ||
#!/bin/sh | #!/bin/sh | ||
Line 55: | Line 68: | ||
fi | fi | ||
+ | </nowiki> | ||
+ | |||
+ | == CMD Script For Easier Use (Windows) == | ||
+ | |||
+ | A CMD script can be used that starts OpenOCD, runs the svf file and shuts down afterwards, allowing conveniently programming the FPGA using a single console command. | ||
+ | |||
+ | * Create the directory ''OpenOCD\cmd'' and the file ''mx10spider.cmd'' in this directory. | ||
+ | * Insert the content in this file from below. | ||
+ | * Add the folder to the path variable. | ||
+ | |||
+ | * Now you can open a console and use the command: | ||
+ | * '''mx10spider''' ''<path\to\file.svf>'' | ||
+ | |||
+ | <div><ul> | ||
+ | <li style="display: inline-block;"> [[File:Windowscmd.png|x300px|thumb|Example CMD to programm the FPGA.]] </li> | ||
+ | </ul></div> | ||
+ | |||
+ | For this script OpenOCD was installed under ''C:\OpenOCD\bin\openocd.exe'', adjust this path as necessary. | ||
+ | |||
+ | '''mx10spider.cmd''' | ||
+ | <nowiki> | ||
+ | "C:\OpenOCD\bin\openocd.exe" -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" | ||
</nowiki> | </nowiki> | ||
Line 60: | Line 95: | ||
Due to a hardware issue on the MX10, in order to get PIC JTAG programming through OpenOCD to work, one has to desolder four resistors on the module. | Due to a hardware issue on the MX10, in order to get PIC JTAG programming through OpenOCD to work, one has to desolder four resistors on the module. | ||
− | [[File:Mx10-resistors-to-remove.pdf | page=1 | left | 750px | thumb | One resistor on the top side of the module.]] | + | [[File:Mx10-resistors-to-remove.pdf | page=1 | left | 750px | thumb | One resistor on the top side of the module, marked with a red cross.]] |
− | [[File:Mx10-resistors-to-remove.pdf | page=2 | center | 750px | thumb | Three resistors on the bottom side of the module.]] | + | [[File:Mx10-resistors-to-remove.pdf | page=2 | center | 750px | thumb | Three resistors on the bottom side of the module, each marked with a red cross.]] |
Revision as of 12:31, 19 September 2019
Contents
Installing OpenOCD (Linux)
- 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 (github).
Installing OpenOCD (Windows)
- OpenOCD Version >= 0.10 with the libftdi driver is required.
- Prebuild binaries can be downloaded from GNU MCU Eclipse
- The .zip file can be unpacked to any location
- Install the libusbK driver for the JTAG interface
- Download and start Zadig
- Select MX10/Spider JTAG (Interface 0) and libusbK driver and click Install Driver.
Shell Script For Easier Use (Linux)
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 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"
- Logout and login again or run the following command to reload the path variable:
- $ source ~/.profile
- Open .profile in your home directory with a text editor and add the line:
- Open a terminal and add the executable flag.
- $ chmod +x .local/bin/mx10spider
- You are now ready to program the fpga using the command:
- $ mx10spider <path/to/file.svf>
- If your project is for example located under /opt/quartus_projects/Example, use one of the following commands:
- $ mx10spider /opt/quartus_projects/Example/output_files/Example.svf
- $ mx10spider /opt/quartus_projects/Example/output_files/Example_pof.svf
- for programming the .sof or .pof file respectively.
mx10spider:
#!/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 -e "\tError: No file specified.\n\tUsage: $me <file.svf>" elif [ "$1" = "-h" ] || [ "$1" = "--help" ]; then echo -e "\tUtility script to start openocd and run an svf file.\n\tUsage: $me <file.svf>" else echo -e "\tFile not found: $1\n\tUsage: $me <file.svf>" fi
CMD Script For Easier Use (Windows)
A CMD script can be used that starts OpenOCD, runs the svf file and shuts down afterwards, allowing conveniently programming the FPGA using a single console command.
- Create the directory OpenOCD\cmd and the file mx10spider.cmd in this directory.
- Insert the content in this file from below.
- Add the folder to the path variable.
- Now you can open a console and use the command:
- mx10spider <path\to\file.svf>
For this script OpenOCD was installed under C:\OpenOCD\bin\openocd.exe, adjust this path as necessary.
mx10spider.cmd
"C:\OpenOCD\bin\openocd.exe" -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"
MX10 Hardware Issue
Due to a hardware issue on the MX10, in order to get PIC JTAG programming through OpenOCD to work, one has to desolder four resistors on the module.