Intel Agilex® 7 Configuration User Guide

ID 683673
Date 4/28/2023

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

5.6.5. Adding an Application Image

Complete the following steps to add an application image to flash memory:

  1. Set up exclusive access to the AS x4 interface and flash memory by running the QSPI_OPEN and QSPI_SET_CS commands in the Tcl Console window. You now have exclusive access to the AS x4 interface and flash until you relinquish access by running the QSPI_CLOSE command. Write the new application image to the flash memory using the QSPI_WRITE command.
  2. Alternatively, the rsu1.tcl script includes the program_flash function that programs a new application image into flash memory. The following command accomplishes this task:
    program_flash new_application_image.rpd 0x03FF0000 1024

    The program_flash function takes three arguments:

    1. The .rpd file to write to flash memory.
    2. The start address.
    3. Number of words to write for each QSPI_WRITE command. The QSPI_WRITE supports up to 1024 words per write instruction.

    Figure 80. Program New Application Image
    $ source rsu1.tcl
    $ program_flash new_application_image.rpd 0x03ff0000 1024
    total number of words is 584704
    total number of page is 571
    total number of sector is 36
    reading rpd is completed
    start writing flash
    writing flash is completed
  3. Write the new application image start address to a new image pointer entry in the configuration firmware pointer block (CPB) using the QSPI_WRITE command. Ensure that the new image pointer entry value is 0xFFFFFFFF before initiating the write.
    Note: When using HPS to manage RSU, you must update both copies of the Configuration Pointer Block (CPB0 and CPB1) and the sub-partition table (SPT). In a non-HPS case, while updates to both copies of the pointer blocks are mandatory, the updates to the sub-partition table are not required. For more details about the SPT and CPB, refer to Sub-partition Table Layout for the sub-partition table layout and Pointer Block Layout for the pointer block layout.
Based on the example described above, the address offset 0x20 in the CPB0 and CPB1 must point to the start address of the application image. The next new image pointer entry value must be 0xFFFFFFFF before you write the start address of the new application image to the next image pointer entry.
You can use the QSPI_read function verify that the new image pointer entry value is 0xFFFFFFFF . The QSPI_read function takes in two arguments:
  1. Start address
  2. Number of words to read

Figure 81. Verifying that the New Image Pointer entry Value is 0xFFFFFFFF
$ qspi_read 0x004a0020 1
$ qspi_read 0x004a0028 1
% qspi_read 0x004a8020 1
% qspi_read 0x004a8028 1
You can now proceed to write the new application image address to next image entry by using the QSPI_write_one_word function. The QSPI_write_one_word function takes in two arguments:
  1. Address
  2. The value of the word
Figure 82. Writing an Address Pointer to the New Image Pointer Entry
% qspi_write_one_word 0x004a0028 0x02000000
% qspi_write_one_word 0x004a8028 0x02000000

You can now do a QSPI_read function to the next image pointer entry to ensure that it is written with the start address of the desired new application image.

Verifying the Update to the New Image Pointer

% qspi_read 0x004a0028 1
% qspi_read 0x004a8028 1

Host software can now reconfigure the Intel Agilex® 7 FPGA with the new application image by asserting the nCONFIG pin. Alternatively, you can power cycle the PCB. After reconfiguration, check the current image address. The expected address is 0x03ff0000. After adding a new image, your application image list includes the newly added application image and the old application image, which is now a secondary image. The newly added application image has the highest priority.

Note: When the remote system update host loads an application image, the decision firmware traverses the image pointer entries in reverse order. The new image has the highest priority when you restart the device.