Nios® II Software Developer Handbook

ID 683525
Date 8/28/2023
Public
Document Table of Contents

16.1.16. nios2-flash-programmer-generate

Usage

nios2-flash-programmer-generate [--accept-bad-sysid]
 [--add-bin <fname> <flash-slave-desc> <offset>]
 [--add-elf <fname> <flash-slave-desc> <extra-elf2flash-arguments>]
 [--add-sof <fname> <flash-slave-desc> <offset>
 <extra-sof2flash-arguments>]
 [--cable <cable name>] [--cpu <processor_name>] [--debug]
 [--device <device name>] [--erase-first] [--extended-help]
 --flash-dir <directory> [--go] [--help] [--id <address>]
 [--instance <instance value>] [--log <filename>] [--mmu]
 [--program-flash] [--script-dir <directory>] [--sidp <address>]
 [--silent] --sopcinfo <filename> [--verbose] [--version]

Options

  • --accept-bad-sysid: Continue even if the system identifier (ID) comparison fails.
  • --add-bin <fname> <flash-slave-desc> <offset>: Specify a binary file to convert and program. The filename, target flash slave descriptor, and target offset amount are required. This option can be used multiple times for SRAM Object Files (.sof).
  • --add-elf < fname > <flash-slave-desc> < extra-elf2flash-arguments >: Specify a .elf file to convert and program. The filename and target flash slave descriptor are required. This option can be used multiple times for .elf files. <extra-elf2flash-arguments> can be any of the following options supported by elf2flash:
    • save
    • sim_optimize

      The following elf2flash options have default values computed, but are also supported as <extra-elf2flash-arguments> for manual override of those defaults:

    • base
    • boot
    • end
    • reset
  • --add-sof <fname> <flash-slave-desc> <offset> <extra-sof2flash-arguments>: Specify a .sof file to convert and program. The filename, target flash slave descriptor, and target offset arguments are required. This option can be used multiple times for .sof files. <extra-sof2flash-arguments> can be any of the following options supported by sof2flash:
    • activeparallel
    • compress
    • save
    • timestamp
    • options
  • --cable <cable name>: Specifies which JTAG cable to use (not needed if you only have one cable). Not used without --program-flash option.
  • --cpu <processor_name> : The Nios II processor name from the .sopcinfo file. Not required if only one Nios II processor in the system.
  • --debug: Sends debug information, exception traces, verbose output, and default information about the command's operation, to stdout.
  • --device <device name>: Specifies in which device you want to look for the Nios II debug core. Device 1 is the device nearest TDI. Not used without --program-flash option.
  • --erase-first: Erase entire flash targets before programming them. Not used without --program-flash option.
  • --extended-help: Displays full information about this command and its options.
  • --flash-dir <directory>: Path to the directory where the flash files are generated. Use . for the current directory. This command overwrites pre-existing files in <directory> without warning.
  • --go: Run processor from reset vector after program.
  • --help: Displays basic information about this command and its options.
  • --id <address>: Unique ID code for target system. Not used without --program-flash option.
  • --instance <instance value>: Specifies the INSTANCE value of the debug core (not needed if there is exactly one on the chain). Not used without --program-flash option.
  • --log <filename>: Creates a debug log and write to specified file. Also logs debug information to stdout.
  • --mmu: Specifies if the processor with the corresponding INSTANCE value has an MMU (not needed if there is exactly one processor in the system). Not used without --program-flash option.
  • --program-flash: Providing this flag causes calls to nios2-flash-programmer to be generated and executed. This results in flash targets being programmed.
  • --script-dir <directory>: Path to the directory where a shell script of this tool’s executed command lines is generated. This script can be used in place of this nios2-flash-programmer-generate command. Use . for the current directory. This command overwrites pre-existing files in <directory> without warning.
  • --sidp <address>: Base address of system ID peripheral on the target. Not used without --program-flash option.
  • --silent: Suppresses information about the command's operation normally sent to stdout.
  • --sopcinfo <filename>: The .sopcinfo file.
  • --verbose: Sends verbose output, and default information about the command’s operation, to stdout.
  • --version: Displays the version of this command and exits with a zero exit status.

Description

The nios2-flash-programmer-generate command converts multiple files to a .flash in Motorola S-record format, and programs them to the designated target flash devices (--program-flash). This is a convenience utility that manages calls to the following command line utilities

  • bin2flash
  • elf2flash
  • sof2flash
  • nios2-flash-programmer

This utility also generates a script that captures the sequence of conversion and flash programmer commands.

If no command-line arguments are specified, this command returns an exit value of 1 and sends a help message to stderr.

Example

nios2-flash-programmer-generate --sopcinfo=C:\my_design.sopcinfo \
 --flash-dir=. \
 --add-sof C:\my_design\test.sof 0x0C000000 memory_0 compress save \
 --add-elf C:\my_app\my_app.elf 0x08000000 memory_0 \
 --program-flash