What is OpenOCD?
OpenOCD stands for Open On-Chip Debugger. It is an open-source software that supports debugging a wide variety of chips, devices and boards using a range of supported debug interfaces. If you find a device which is not supported by OpenOCD, being an open-source software, you can add support for that device in OpenOCD yourself and submit patches so that your improvements can be merged into OpenOCD for others to use. OpenOCD is used for debugging as well as in-system programming for embedded target devices. The Telesto MAX10 FPGA board features a high-speed USB 2.0 interface which is connected to MAX 10 FPGA IC’s JTAG signals. So, Telesto can be programmed using its on-board USB interface using OpenOCD, without the need for a separate external JTAG programmer.
To configure Telesto using OpenOCD you require:
- Telesto MAX10 FPGA Module
- USB A to Micro B Cable
- Quartus Prime Programmer
Configuration using OpenOCD
The following steps will walk you through the process of configuring Telesto MAX10 FPGA board using OpenOCD.
Download and extract the latest Windows version of OpenOCD from its website http://openocd.org to a suitable location in your system.
To program Telesto through its USB interface, “WinUSB” drivers need to be installed instead of the default drivers installed by Windows. To install “WinUSB” drivers, download and run latest version of “Zadig“. Go to Options -> List all devices and select it.
Select “Telesto MAX10 FPGA Module (Interface 1)” as shown in the image below.
Select “WinUSB” drivers in target driver to replace the “FTDIBUS” drivers. Click “Replace Driver” to install WinUSB drivers as follows.
You will see the following message if drivers were installed correctly.
Download numato_telesto10m16.cfg from here. Save the downloaded “numato_telesto10m16.cfg” file to the “openocd/scripts/board” directory. Open Command Prompt or PowerShell in “bin-x64” directory which is located in “openocd” folder.
An SVF file is required to program Telesto MAX10 FPGA Module using OpenOCD. Here’s how to create .svf file using Quartus Prime Programmer:
Open the .sof/.pof file in Quartus Prime Programmer, go to File -> Create JAM, JBC, SVF or ISC File.
When the SVF file is created successfully, you will see the following dialog window.
Use the following command in Command Prompt or PowerShell to program FPGA. You might need to replace “../counter.svf” with the actual location of your .svf file. OpenOCD should show output similar to the image shown below if the programming process finished successfully.
openocd -f ../scripts/board/numato_telesto10m16.cfg -c init -c "svf ../counter.svf" -c shutdown
You can also add an optional “-quiet” argument to decrease the amount of output thrown on screen.
openocd -f ../scripts/board/numato_telesto10m16.cfg -c init -c "svf -quiet ../counter.svf" -c shutdown
To change the drivers back to FTDI USB drivers follow these steps:
Open Device Manager->Universal Serial Bus Devices, select Telesto MAX10 FPGA Module, right-click and select “Uninstall device”. In the “Uninstall Device” dialog window, select “Delete the driver software for this device.” and click “Uninstall”.
Now, to verify, Scan for hardware changes to see USB Serial Converter B under “Universal Serial Bus Controllers”.