1. Use Nios II utilities elf2flash and nios2-elf-objcopy to convert Factory Nios II
code and User Nios II code to factory_sw.hex and user_sw.hex, respectively.
2. Use quartus_cpf utility according to a given configuration file flash.cof to merger
all files (factory_sw.hex, user_sw.hex, factory .sof file, user .sof file, and option bit)
into a single file flash.pof.
3. Use jtagconfig utility to adjust jtag speed.
4. Use quartus_pgm utility to program flash with flash.pof.
Developers can copy their .sof & .efl files into the factory folder or the user folder, and
launch the flash_program.bat to program their code into the CFI-Flash.
4.9 Restore Factory Settings
This section describes how to restore the original Factory image and User image into
the flash memory device on the FPGA development board. A programming batch file
located in the Flash_Restored folder is used to restore the flash content. Performing
the following instructions can restore the flash content:
1. Make sure the Nios II EDS and USB-Blaster II driver are installed.
2. Make sure the FPGA board and PC are connected with an USB Cable.
3. Power on the FPGA board.
4. Copy the “Demonstrations/Flash_Restored” folder under the CD to your PC’s
local drive.
5. Execute the batch file flash_program.bat to start flash programming.
After restoring the flash, perform the following procedures to test the restored boot
code.
1. Power off the FPGA Board.
2. Set FPGA configuration mode as AVSTx8 Mode by setting SW4/5 MSEL[2:0]
to 110.
3. Specify configuration of the FPGA to Factory Hardware by setting the
FACTORY_LOAD dip in SW4 to the ‘1’ position.
4. Power on the FPGA Board, and the Configure Done LED should light up.
The batch file converts the Factory and User .sof/.elf and PFL option bit into a
flash.pof file and use Quartus Programmer to program the CFI-Flash with the