Device Family: Arria V GT, Arria V GX, Arria V GZ, Arria V ST, Arria V SX, Cyclone V E, Cyclone V GT, Cyclone V GX, Cyclone V SE, Cyclone V ST, Cyclone V SX, Stratix V E, Stratix V GS, Stratix V GT, Stratix V GX
Type: Answers, How-To
Area: Embedded, Tools

Last Modified: December 06, 2015
Version Found: v13.1

Nios® II Boot from EPCQ or EPCS in Quartus® II 13.1


Due to a problem in the Quartus II software, the Quartus Programmer must be used to program EPCQ devices using a generated .jic file in order to enable 4 bytes addressing mode.   The nios2-flash-programmer is then required to program the EPCS/EPCQ device with the .flash file generated by the sof2flash tool in order to include the header information required by the new Nios II bootcopier.

The new Nios II bootcopier introduced in Quartus® II 13.1 requires a new work flow.


To enable the Nios II processor  to load software from EPCS / EPCQ after power cycle or reset  in the Quartus II software version 13.1 and later follow the steps below:


1.      Add the following 2 lines in your <project>.qsf file.

a.        set_global_assignment -name STRATIXV_CONFIGURATION_SCHEME "ACTIVE SERIAL X1"

b.        set_global_assignment -name ENABLE_INIT_DONE_OUTPUT ON

2.      Delete the “db”, “incremental_db” and “qsys generated folders” in your project directory.

3.      Make sure the Nios II’s Reset Vector is pointing at EPCS/EPCQ Controller.

4.      Make sure the Nios II’s Exception Vector is pointing at onchip_memory or some other memory devices.

5.      Generate in Qsys.

6.      Compile in Quartus II.

7.      Note: If the design is not targeting EPCQ device, skip this step

Generate the .jic file with “Convert Programming File” tool.

a.        Select .jic file for “Programming file type”.

b.        Select the correct EPCQ device for “Configuration device”.

c.        Make sure “Active Serial” is selected for “Configuring device mode”.

d.       Click on “Flash Loader”, then click on “Add Device” to select the device you’re using then clicks “Ok”.

e.        Click on “SOF Data”, and then click on “Add File” to select the .sof file generated by Quartus II compilation.

f.         Click on the .sof file you have just added, click on “Properties” and enable the “Compression” from there.

g.        Click on “Generate” to generate the .jic file.

h.        Program the EPCQ with the .jic file generated with Quartus Programmer and power-cycle the board.

8.      Generate the .flash files for the .sof and .elf files with:

a.        sof2flash --input=hw.sof --output=hw.flash --XX –verbose

Note: Replace XX with EPCS for EPCS device and replace XX with EPCQ for EPCQ device

b.        elf2flash --input=sw.elf --output=sw.flash --epcs --after=hw.flash –verbose

9.      Use nios2-configure-sof or Quartus Programmer to configure the FPGA with the .sof file then program the EPCQ device with the Nios II Flash Programmer as follow:

a.        nios2-flash-programmer --epcs --base=<base address of EPCQ device> hw.flash

Note: The EPCQ need to be programmed with the .flash file even if it had been programmed with Quartus Programmer earlier in .jic format

b.        nios2-flash-programmer --epcs --base=<base address of EPCQ device> sw.flash