Nios® II Flash Programmer User Guide

ID 683118
Date 11/06/2017
Document Table of Contents

3. Using the Flash Programmer from the Command Line

The Nios® II development tools provide command-line utilities which give you complete control of the Nios® II Flash Programmer features. You can create a custom script file to automate a flash programming task.

Alternatively, you can use the flash programmer GUI.

For more information about the flash programmer GUI, refer to the "Using the Flash Programmer GUI" chapter.

The Nios® II Flash Programmer GUI programs flash memory by creating a script based on the command-line utilities. The script is well-formed, customized to your project, and human-readable. You can use it as a reference for flash programmer command-line syntax. The GUI-generated script is particularly helpful if you need to use the --instance parameter listed in the xref table.

After you successfully program flash memory using the Nios® II Flash Programmer GUI, you can find the flash programmer script in the directory you specified in the Staging Directories dialog box, available on the Options menu. The flash programmer script is a file named

Table 4.  Flash Programmer Command-Line Utilities
Command-Line Utility Description
quartus_pgm --nios2 Programs an S-record file into flash memory. Can also read back data, verify data, provide debug information about the flash chip, and more.
sof2flash Converts an SRAM Object File (.sof) to an S-record file.
elf2flash Converts a Nios® II Executable and Linking Format File (.elf) to an S-record file.
bin2flash Converts an arbitrary data file to an S-record file.

The main utility for programming flash memory from the command line is quartus_pgm --nios2. It requires industry-standard S-record input files. These utilities ensure that the input is compatible with the Nios® II Flash Programmer. Input file names for all utilities must include an explicit extension, such as .elf or .flash.

When you launch the Nios® II Command Shell, in a Windows® operating system, the flash programmer utilities are available in your default search path.

For more information about the Nios® II Command Shell, refer to the "Getting Started from the Command Line" chapter of the Nios® II Software Developer's Handbook.

The following sections list the utilities and their functions.