cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5: Bootloader in Internal Flash can't run Application in External OctoSPI NOR Flash

sravani
Associate III

Hi All,

I’m working on a project with the STM32U5G9ZJT6, where I’ve implemented a bootloader in internal flash at 0x08000000. The application is stored in external OctoSPI NOR flash (MX66LM1G45G), which is memory-mapped to address 0xA0000000 using Octal STR mode.

I'm flashing the application binary into external flash using an external loader (.stldr) via STM32CubeIDE.

Although the application is successfully stored in external flash, when I try to execute it via memory-mapped mode, it fails (shows “Target Failed” or halts). I’m not sure whether it’s due to memory mapping, stack configuration, MPU, or something else.

Could someone guide me on the correct procedure or help me troubleshoot this issue?

 

What I’ve Done So Far:
Bootloader:

Configured OSPI (HSPI1 / OCTOSPI2) to enable memory-mapped mode using MX66LM1G45G_EnableSTRMemoryMappedMode().

Verified that data can be read from 0xA0000000.

Read the initial MSP and Reset_Handler from external flash:


uint32_t app_msp = *(uint32_t*)0xA0000000;
uint32_t app_reset = *(uint32_t*)(0xA0000000 + 4);
Jumped to the application using:

__disable_irq();
HAL_RCC_DeInit();
HAL_DeInit();
SysTick->CTRL = 0;
__set_MSP(app_msp);
SCB->VTOR = 0xA0000000;
((void (*)(void))app_reset)();


Memory Mapping:

Bootloader stack: 0x20000000 (top of SRAM2)

Application stack: 0x20080000 (top of SRAM1)

Linker scripts split RAM regions accordingly

Application binary is placed at 0xA0000000 using a custom .ld file and flashed using STM32CubeProgrammer with .stldr loader

Problem / Clarification Needed:
After jumping to the application, am getting below issue.

sravani_0-1752126056297.png

 

I want to confirm:

Is the SCB->VTOR method enough for XIP from external flash?

Are there MPU or cache settings I need to change before jumping?

Should I manually clean/disable any cache (ICACHE, DCACHE) before the jump?

Any special constraints for enabling OctoSPI STR mode with XIP on STM32U5?

 

Please provide any reference links.

0 REPLIES 0