We have a bootloader running in XIP QSPI flash (0x60000000) and this bootloader copies the application image sits in QSPI to the external SDRAM (0x80000000). The SDRAM image is built for SDRAM using a linker script and seems ok (at least IntelHex file seems ok)
Bootloader initialises the SEMC for the SDRAM and runs a SDRAM test for the whole address range, so SDRAM should be ok.
But after jumping I am getting a PRECISERR Bus Fault.
My jump code is simple,
/* Set Main Stack Pointer; WORD 0 */
__set_MSP(*(uint32_t*) SDRAM_OFFSET );
/* App start point; WORD 1 */
voidFP app = (voidFP)(*(uint32_t *)(SDRAM_OFFSET + 4));
/* Jump to Application */
After I jump, I immediately get a hard fault handled in Bootloader Hardfault Handler which say Bus Fault. I get PRECISERR bus fault and the fault address (SCB->BFAR) is the top of the stack; 0x20020000
I know i need to set the SDRAM image vector table before jump, but if I set I dont get anything because if I cannot jump to the application, I never access the fault handler located in SDRAM.
I hope it is not about Data caching on SDRAM.
I have seen some SDRAM example from the SDK but they run the image from the internal SRAM(DTCM, 0x20002000) if I dont miss something here.
Just is there any limitation for running images on external SDRAM using SEMC?