STM32U575 External Loader (.stldr): Init() timeout
- 3 replies
- 33 views
Hello. I'm developing a custom STM32CubeProgrammer External Loader for an STM32U575 board connected to an AT25SF641B SPI NOR Flash (8 MB).
The loader is recognized by STM32CubeProgrammer and loaded into RAM correctly, but I'm experiencing a mix of issues and I'm running out of ideas.
- MCU: STM32U575
- External Flash: AT25SF641B
- Interface: SPI1 + GPDMA
- STM32CubeProgrammer: v2.23.0
- Toolchain: GCC (STM32CubeIDE)
The loader is correctly detected by CubeProgrammer.
CubeProgrammer executes:
Init flashloader...
run ap 0
and after about 100 seconds reports:
Init function fail with timeout
A minimal Init():
int Init(void)
{
return LOADER_OK;
}works correctly.
The problem appears only when initialization code is enabled.
Current implementation:
int Init(void)
{
extern uint32_t __isr_vector_start__;
extern uint32_t _sbss;
extern uint32_t _ebss;
ERROR_T ErrorValue;
SystemInit();
SystemCoreClockUpdate();
SCB->VTOR = (uint32_t)&__isr_vector_start__;
__DSB();
__ISB();
ErrorValue = CUBEMX_Init();
if (ErrorValue != E_OK)
{
return LOADER_FAIL;
}
ErrorValue = Loader_FLASH_Init();
if (ErrorValue != E_OK)
{
return LOADER_FAIL;
}
return LOADER_OK;
}The SPI driver is DMA-based.
During initialization, Loader_FLASH_Init() registers SPI callbacks. The AT25SF641B driver performs SPI transfers through HAL_SPI_TransmitReceive_DMA().
When the project is executed under STM32CubeIDE debugger, the DMA transfer completes correctly and the SPI callbacks are invoked.
When the same code is executed as a .stldr through STM32CubeProgrammer, the behavior is different.
