RT117x: NVIC_SystemReset() behaviour when dual image is enabled

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RT117x: NVIC_SystemReset() behaviour when dual image is enabled

174 Views
mastupristi
Senior Contributor I

Hello,

I configured the xSPI_FLASH_SEC_IMG_OFFSET 0xC80[23:16] fuses to have the dual image configuration (I have a QSPI on FlexSPI). I wrote a FW that is able to swap between the two images using the Bootloader API (see 10.13.3 ref. man.)
The FW is also able to print the ccontent of the SRC->GPR registers, specifically 0, 1, 2, 3, 4, and 9 which should be used by the rom bootloader (see note in 25.6.1.7).

Suppose we have image0 at offset 0 with image version 5, and image1 at offset 4MB with image version 4.
After a power cycle image0 always starts. After that I swap, going through the booloader API, and run image1. If I call NVIC_SystemReset() at this point though it restarts image1.
NVIC_SystemReset() causes a reset, so the ROM bootloader should run, and I expected it to choose image0.

The only thing I can imagine is that this may depend on the value of the GPR registers managed by ROM bootloader.

Below is their value:

After power cycle:

GPR[00] = 0x00000000
GPR[01] = 0x00000000
GPR[02] = 0x00000000
GPR[03] = 0x00000000
GPR[04] = 0x00000000
GPR[09] = 0x00000000

 

after swap image0 -> image1:

GPR[00] = 0x00000000
GPR[01] = 0x00000000
GPR[02] = 0x00000000
GPR[03] = 0x00000000
GPR[04] = 0x00000000
GPR[09] = 0x04000000

 

after calling NVIC_SystemReset() from image1:

GPR[00] = 0x00000000
GPR[01] = 0x00000000
GPR[02] = 0x00000000
GPR[03] = 0x00000000
GPR[04] = 0x00000000
GPR[09] = 0x04000000

 

the only bit to change is 26, which is part of the PERSIST_REDUNDANT_BOOT field:

mastupristi_0-1718023366604.png

However, the PERSIST_REDUNDANT_BOOT field is described “Used for both SPI NAND and SLC raw
NAND devices”, which is not my case since I use a QSPI NOR on FlexSPI.

The one dedicated to FlexSPI NOR seems to be only PERSIST_SECONDARY_BOOT which is not touched though.

Effectively trying to reset GPR[9] before the NVIC_SystemReset() call, the ROM bootloader reloads image0.

  • So can you explain what's going on? I am under the impression that the descriptions in Table 10-8 are incomplete if not completely wrong.
  • Could you please explain these two fields here in great detail and comprehensively? And then I suggest you update the documentation.
  • Is my intuition to reset GPR[9] before the reboot correct or is it a fluke?

regards

Max

0 Kudos
1 Reply

121 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hi @mastupristi 

Thank you for bringing this topic. I am currently investigating and looking forward to solve this question. I will test on my side see if I can replicate this as well.

Diego

0 Kudos