5.6.6. Removing an Application Image
- 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.
- Write 0x00000000 to the application image start address stored in the image pointer entry of the configuration firmware pointer block (CPB0 and CPB1) using the QSPI_WRITE command.
Note: You must update both copies (copy0 and copy1) when editing the configuration firmware pointer block and sub-partition table.
- Erase the application image content in the flash memory using the QSPI_ERASE command.
- To remove a new application image, add another new application image in the next or subsequent image pointer entry or allow the device to fall back to the previous or secondary application image in your application image list. The following table shows correct entries for image pointer entries for CPB0 and CPB1 for offsets 0x20 and 0x28 :
Table 50. Configuration Firmware Pointer Block Contents CPB Start Address + 0x20 Content Value CPB0 + 0x20 = 0x004A0020 Old application image pointer entry (lower priority) 0x004B000 CPB0 + 0x28 = 0x004A0028 Current/new application image pointer entry (highest priority) 0x02000000 CPB1 + 0x20 = 0x004A8020 Old application image pointer entry (lower priority) 0x004B0000 CPB1 + 0x28 = 0x004A8028 Current/New application image pointer entry (highest priority) 0x02000000Figure 83. Read Current CPB Values
% qspi_read 0x004A0020 1 0x004B0000 % qspi_read 0x004A0028 1 0x02000000 % qspi_read 0x004A8020 1 0x004B0000 % qspi_read 0x004A8028 1 0x02000000
You can now remove the current or new application image address image pointer entry by writing the value to 0x00000000 using the QSPI_write_one_word function as shown in the following example. The QSPI_write_one_word function takes address and data arguments. Be sure to erase the application content that you just removed from flash memory.Figure 84. Remove Application Image
% qspi_write_one_word 0x004A0028 0x00000000 % qspi_write_one_word 0x002ec028 0x004A8028
You can use a QSPI_read to the image pointer entry at offset 0x28 for CBP0 and CPB1 to verify completion of the QSPI_write_one_word commands .Figure 85. Verify the Writes
% qspi_read 0x004A0028 1 % qspi_read 0x004A8028 1
You can now configure the device with the old application image. The old application image has the highest priority if you power cycle the device or the host asserts the nCONFIG pin. You can run the rsu_status report to check the status of the current image address.