AN 773: Drive-On-Chip Design Example for Intel® MAX® 10 Devices

ID 683072
Date 7/26/2023
Document Table of Contents

4.7. Programming the Design into Flash Memory

For the Drive-On-Chip Design Example for Intel® MAX® 10 devices, you can store the FPGA configuration file in the Intel® MAX® 10 on-chip flash memory; you can store the software executable in external QSPI flash memory.
  1. Rebuild the design with the Nios II reset vector pointing to the QSPI memory
    The quartus.ini file with PGMIO_SWAP_HEX_BYTE_DATA=ON content is required in the project directory.
  2. Compile the software and generate the software programmer object file.
    1. In the Nios II SBT, open the BSP editor.
    2. Unselect all advanced.hal.linker option.
    3. Modify the linker script to point the reset section to the qspi memory.
    4. Build the BSP project and the main project.
    5. Generate the .hex file by right-clicking DOC_TANDEM_MAX10 > Make Targets > Build > mem_init_generate.
    6. In the Quartus Prime software click File > Convert Programming Files and enter these settings:.
      • Configuration device: CFI_512Mb.
      • Mode: 1-bit Passive Serial.
    7. Change the file name to the desired path and name. For example SW.pof.
    8. In Input files to convert, remove SOF Page_0.
    9. Click ADD HEX Data,
    10. Choose the generic_quad_spi_controller_0.hex file generated previously in step 2e.
      This file is in the mem_init subdirectory of the software project.
    11. Select Absolute Addressing and click OK.
    12. Click Generate to create the .pof file.
  3. Program the software into QSPI flash.
    1. Ensure DIP SW2 is set to OFF-ON-ON-ON.
    2. Download the parallel Flash Loader from rocket boards
    3. Program the parallel flash loader (max10_qpfl.sof) into the MAX 10 device to program the QSPI flash, using Quartus Programmer.
    4. Right click on the MAX 10 FPGA and select Edit > Change File.
    5. Choose the max_qpfl.sof file.
    6. Turn on MAX 10 device under Program/Configure.
    7. Click Start to start programming.
    8. Click on Auto Detect after max10_qpfl.sof was successful.
      A new QSPI flash device is shown, attached to the MAX10.
    9. Program the software image into QSPI flash.
    10. Right click on the SQPI device and select Edit > Change File
    11. Choose the generated .pof file (SW.pof).
    12. Check the .hex file under Program/Configure.
    13. Click Start to start programming.
  4. Program hardware .sof file into the MAX 10 FPGA.
    1. Right click on the MAX 10 FPGA and select Edit > Change File.
    2. Choose the .sof file generated from Quartus Prime project compilation.
    3. Click Start to start programming.