last-written byte of ITCM apparently getting modified by NVIC_SystemReset();
We're running into a really weird situation with a bootloader that copies some code into ITCM. The bootloader initializes various peripherals and clocks and then copies data from the QSPI flash to both the SRAM and to the ITCM memory. Then we use the NVIC_SystemReset() call to fully reset everything (apparently there's an Errata that some things don't get properly de-initialized unless a full reset is called). But we are running into a very strange situation whereby it looks like the last byte that was written into ITCM gets corrupted by the SystemReset call! We've tried a few things like settng the ITCM to not be cacheable and calling SCB_CleanDCache before doing the reset. It always seems to be the last byte written. As a test, I used memset to zero-out an additional 35 bytes, and the problem happened at the last byte of the memset. The value seems to be possibly related to some other ITCM contents (e.g. if I zero out the entire ITCM before copying the the code, then the 'bad' value is 0, otherwise it's some other value e.g. 0x1b. How does it even know what the last-written address is? The same copy function is then used to copy to SRAM, so it doesn't seem likely that it's some register value. I'm Shook!
