Embedded Design Handbook

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

5.3.7.5. Booting From On-Chip Memory

In this section, use the Intel® Quartus® Prime software to program the small boot copier in the boot_rom memory of the FPGA, and then use the Nios® II flash programmer to program the test application boot record in CFI flash memory.

To program the boot copier in the FPGA’s boot_rom memory, perform the following steps:

  1. Change to the <project> /boot_copier_sw/app/small_boot_copier directory.
  2. Copy small_boot_copier.hex to the Intel® Quartus® Prime project directory and rename it eth_std_main_system_boot_rom.hex using the following command:
    cp small_boot_copier.hex ../../../eth_std_main_system_boot_rom.hex 
    
    //Press ENTER
    Note: You may see a warning that a file by that name already exists in that directory. If you are asked to replace the old file, click Yes.

    The next Intel® Quartus® Prime compilation implements the boot copier executable as the contents of boot_rom.

  3. If Platform Designer is still open, return to it and click Exit to close it.
  4. In the Intel® Quartus® Prime window, on the Assignments menu, click Settings.
  5. In the Category list, click Compilation Process Settings, then turn on Use Smart Compilation. This option prevents recompilation of the entire design when only an update to the on-chip memory contents is required. The first Intel® Quartus® Prime compile, however, must be a full compile, because adding an on-chip memory to the system changed the design.
  6. On the Processing menu, click Start Compilation to compile the Intel® Quartus® Prime project.
  7. When compilation is complete, on the Tools menu, click Programmer.
  8. Make sure the <project> \niosii_ethernet_standard_ <board> .sof filename appears in the File column.
  9. Make sure the Program/Configure option is turned on.
  10. Click Start to configure your FPGA with the .sof file.

The boot_rom memory on the FPGA now contains an executable image of the example boot copier.

To program the test application in CFI flash memory, perform the following steps:

  1. In a Nios® II command shell, change to the directory <project> /boot_copier_sw/app/hello_world.
  2. Set the offset in flash memory at which to locate the hello_world boot image, by typing the command:
    bin2flash --input=hello_world.elf.flash.bin \
    44399204953000--output=hello_world.flash \
    --location=0x00240000 
    
    //Press ENTER

    Set the location to 0x240000, because in boot from CFI flash mode, this is the location where the small boot copier expects to find the boot image. The correct value for the --location parameter is the value specified in the command in step 5 in the "Building the Small Boot Copier Using 'make'" section.

  3. Program the hello_world boot image in flash memory by typing the following command:
    nios2-flash-programmer --base=<flash_base> \
    hello_world.flash 
    
    //Press ENTER

    where <flash_base> is the base address of the CFI flash component in your Platform Designer system.