Stratix® 10 Configuration User Guide

ID 683762
Date 4/05/2024
Public
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 88. Program New Application Image
    $ source rsu1.tcl
    /channels/local/top/master_1
    $ program_flash new_application_image.rpd 0x03ff0000 1024
    total number of words is 458752
    total number of page is 448
    total number of sector is 28
    reading rpd is completed
    start erasing flash
    erasing flash 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.
Table 51.  Configuration Firmware Pointer Block Contents
CPB Start Address + 0x20 Content Value
CPB0 + 0x20 = 0x002E4020 Current application image pointer entry (highest priority) 0x002F4000
CPB0 + 0x28 = 0x002E4028 Next image pointer entry 0xFFFFFFFF
CPB1 + 0x20 = 0x002EC020 Current application image pointer entry (highest priority) 0x002F4000
CPB1 + 0x28 = 0x002EC028 Next image pointer entry 0xFFFFFFFF
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 89. Verifying that the New Image Pointer entry Value is 0xFFFFFFFF
$ qspi_read 0x002e4020 1
0x002f4000
$ qspi_read 0x002e4028 1
0xffffffff
% qspi_read 0x002ec020 1
ISR is empty
0x002f40000
% qspi_read 0x002ec028 1
0xffffffff

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 90. Writing an Address Pointer to the New Image Pointer Entry
% qspi_write_one_word 0x002e4028 0x03ff0000
% qspi_write_one_word 0x002ec028 0x03ff

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.

Figure 91. Verifying the Update to the New Image Pointer
% qspi_read 0x002e4028 1
0x03ff0000
% qspi_read 0x002ec028 1
0x03ff0000

Host software can now reconfigure the Stratix® 10 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.