Nios® II Flash Programmer User Guide

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

2.6. Generating Flash Files and Programming Flash Memory

The Nios® II Flash Programmer can generate flash files, program the flash memory with a flash file, or both. The flash programmer can generate flash files from the following different file types:
  • SRAM Object File (.sof) — Contains FPGA configuration data
  • Executable and Linking Format File (.elf)— Contains your executable application software
  • Intel FPGA Zip Read-Only File System File (.zip) — Contains a read-only zip file system associated with your Nios® II software application project
  • An arbitrary binary file

The Nios® II EDS provides the Intel FPGA Zip Read-Only File System software component, which is an easy-to-use tool for storing and accessing data in flash memory. Depending on your application, you might find it more convenient to use the Zip Read-Only File System, rather than storing raw binary data in flash memory.

For information about the Intel FPGA Zip Read-Only File System, refer to the "Read-Only Zip File System" chapter in the Nios® II Gen2 Software Developer’s Handbook.

To generate flash files or to write to flash memory using your flash programmer settings, perform the following steps:

  1. On the Options menu, turn on the actions you wish to perform. The following actions are available:
    • Generate Files—Generates flash files.
    • Program Files—Programs flash memory with the generated flash files.
    • Erase Flash Before Programming—Erases the entire flash memory before writing each flash file to it.
    • Run From Reset After Programming—Runs the processor from its reset vector after flash memory programming is complete.5
  2. To specify the directories where you want the flash programmer to store the generated flash files and script, click Staging Directories in the Options menu and specify the script and flash-files directory paths.
  3. On the tab for the flash memory device you wish to target, under Files for flash conversion, click Add.

    The Nios® II Flash Programmer adds the file to the Files for flash conversion list and derives the flash offset from the file. Depending on your current Options settings, the File generation command and File programming command boxes populate with the command-line commands that generate the .flash file and program it to your flash memory, respectively, providing a convenient way to learn about the command-line utilities.

  4. If you want to pass any additional arguments to the file generation command, under File generation command, click Properties.
  5. If necessary, edit the Conversion Type settings for the files listed in the Files for flash conversion table, by clicking the relevant table cells. Allowed conversion types are ELF, SOF, and BINARY.
  6. If necessary, edit the Flash Offset settings for the files listed in the Files for flash conversion table, by double-clicking the relevant table cells.
    Note: Do not specify a flash offset for files of conversion type ELF.
  7. Click Start. The Nios® II Flash Programmer performs the actions specified by the commands. It stores the generated flash files to the specified flash directory, and captures the commands it runs to the bash shell script in the specified script directory.
    Note: You can use this script to duplicate the same actions again in the future, and to learn about the command-line utilities.
5 Relevant only if you turn on Program Files.