I'm using the MIMXRT1062DVJ6A with external flash (Maconix MX25L25645G) on the FLEXSPI bus in QPI mode. It's 256 Mbit part, so we added 4-byte addressing commands to the customLUT to support it. It works perfectly.
I have two projects that I run on this setup; the factory image, which also serves a bootloader, and a downloadable image, which is the application. The downloadable project is a clone of the factory project—it has no source files of its own, but symbolic links to source files in the factory project. The memory maps are different, though, and there are a couple of macros for the factory code to be able to find the downloaded application and jump to it. The factory image will not change during the lifetime of the product; either it or the downloaded application can get a new application, which the factory code will then program into flash memory.
My factory program uses the canonical jump_to_application() function that loads the stack pointer and program counter from interrupt vector table. After finding there is a valid application available, which is done very early in the boot, it calls jump_to_application() and everything works great until I try to initialize the flash driver. As soon as FLEXSPI_SoftwareReset() is called, and it's only called once after boot—the jump_to_application() call happens well before FLEXSPI_Init(), the processor goes back to the breakpoint I have set at main().
When I examine the interrupt vectors I find they are all pointing to addresses in the downloaded code's memory map. I see the SP and PC registers getting set correctly, and can run or step through over a hundred lines of code (the flash is XIP) that makes calls to various peripherals and even reads lots of flash memory flash memory. But when I get into FLEXSPI_Init() and it calls FLEXSPI_SoftwareReset(), i go right back to main(). A cold boot with no application to jump to runs without any issue of this sort.
I'm open to suggestions. Got any?