Quartus Standalone Programmer
Intel maintains a neat tool called the Quartus Standalone Programmer.
It’s essentially the same tool that the full version of Quartus uses for programming but with the advantage that you don’t have to make a new project each time you want to flash a random .sof file.
While there is a Linux version available, I figured that it might be useful to learn about the underlying utility, quartus_pgm
, that powers the programmer.
The main advantage of doing this is the speed-up from automation as well as the ability to flash directly from your favourite text editor.
I cover the most basic syntax of quartus_pgm
in this post.
Device Discovery
Running quartus_pgm --auto
will show a list of all the available JTAG chains from connected devices. This is what I get with the De1-SoC:
$ quartus_pgm --auto
...
Info: Command: quartus_pgm --auto
Info (213045): Using programming cable "DE-SoC [1-2]"
1) DE-SoC [1-2]
4BA00477 SOCVHPS
02D120DD 5CSE(BA5|MA5)/5CSTFD5D5/..
...
The actual output will be much longer, but the above text is the important part.
It shows that there are 2 JTAG devices available on the same “cable.” When flashing, we have to ensure that we flash the 2nd JTAG device as that’s the FPGA. The first refers to the ARM Processor.
Programming
The following command will flash a file named “MC68K.sof” onto the FPGA device.
$ quartus_pgm -m jtag -o "p;MC68K.sof@2"
...
Info (209016): Configuring device index 2
Info (209017): Device 2 contains JTAG ID code 0x02D120DD
...
Info: Quartus Prime Programmer was successful. 0 errors, 0 warnings
...
Note that the JTAG ID matches that of the FPGA in the first command.
- The -m flag indicates the mode, which in this case is jtag
- The -o flag indicates an operation and is followed by the operation string
- The p; prefix indicates that the current operation is to program the device. For more operation strings see
quartus_pgm --help=o
- “MC68K.sof” is the relative path to the programming file
- The @2 suffix ensured that it was the 2nd JTAG device that was programmed
And that just about covers it for the basics. You can always invoke quartus_pgm --help
to learn more.