Visible to Intel only — GUID: iga1447448336002
Ixiasoft
Visible to Intel only — GUID: iga1447448336002
Ixiasoft
4.1.2.2. elf2flash, bin2flash, and sof2flash
These three commands are often used with the nios2-flash-programmer command. The resulting .flash file is a standard .srec file.
The following two important command-line options are available for the elf2flash command:
- The -boot=<boot copier file>.srec option directs the elf2flash command to prepend a bootloader S-record file to the converted ELF file.
- The -after=<flash file>.flash option places the generated .flash file—the converted ELF file—immediately following the specified .flash file in flash memory.
The -after option is commonly used to place the .elf file immediately following the .sof in an erasable, programmable, configurable serial EPCS or EPCQ flash device.
Before it writes to any flash device, the Nios® II flash programmer erases the entire sector to which it expects to write. In EPCS and EPCQ devices, however, if you generate the software image using the elf2flash -after option, the Nios® II flash programmer places the software image directly following the hardware image, not on the next flash sector boundary. Therefore, in this case, the Nios® II flash programmer does not erase the current sector before placing the software image. However, it does erase the current sector before placing the hardware image.
When you use the flash programmer through the Nios® II SBT, you automatically create a script that contains some of these commands. Running the flash programmer creates a shell script (.sh) in the Debug or Release target directory of your project. This script contains the detailed command steps you used to program your flash memory.
Sample Auto-Generated Script:
#!/bin/sh # # This file was automatically generated by the Nios® II SBT For Eclipse. # # It will be overwritten when the flash programmer options change. # cd <full path to your project>/Debug # Creating .flash file for the FPGA configuration #"< Nios® II EDS install path>/bin/sof2flash" --offset=0x400000 \ --input="full path to your SOF" \ --output="<your design>.flash" # Programming flash with the FPGA configuration #"< Nios® II EDS install path>/bin/nios2-flash-programmer" --base=0x00000000 \ --sidp=0x00810828 --id=1436046714 \ --timestamp=1169569475 --instance=0 "<your design>.flash" # # Creating .flash file for the project "< Nios® II EDS install path>/bin/elf2flash" --base=0x00000000 --end=0x7fffff \ --reset=0x0 \ --input="<your project name>.elf" --output="ext_flash.flash" \ --boot="<path to the bootloader>/boot_loader_cfi.srec" # Programming flash with the project "< Nios® II EDS install path>/bin/nios2-flash-programmer" --base=0x00000000 \ --sidp=0x00810828 --id=1436046714 \ --timestamp=1169569475 --instance=0 "ext_flash.flash" # Creating .flash file for the read only zip file system "< Nios® II EDS install path>/bin/bin2flash" --base=0x00000000 --location=0x100000\ --input="<full path to your binary file>" --output="<filename>.flash" # Programming flash with the read only zip file system "< Nios® II EDS install path>/bin/nios2-flash-programmer" --base=0x00000000 \ --sidp=0x00810828 --id=1436046714 \ --timestamp=1169569475 --instance=0 "<filename>.flash"
The paths, file names, and addresses in the auto-generated script change depending on the names and locations of the files that are converted and on the configuration of your hardware design.