2026-05-25 6:58 AM
Hi,
I’m developing a custom external loader (.stldr) for an STM32N655X0 custom board to program external XSPI NOR flash using STM32CubeProgrammer via a J-Link interface (board does not have ST-LINK).
I have the loader framework working partially:
Init() executes
Sector erase succeeds
Programming fails during download phase
CubeProgrammer logs show repeated “Init flashloader...” calls and eventually errors like:
“Init function fail”
“Could not start CPU (ErrorCode: -1)”
“Cannot read R0 while CPU is running”
The external flash is S25FL064L and erase operation works correctly, so communication with flash seems functional.
I wanted guidance specifically for developing external loaders intended to be used through J-Link in STM32CubeProgrammer:
Are there any additional requirements or limitations when using .stldr loaders via J-Link compared to ST-LINK?
Does CubeProgrammer execute the loader lifecycle differently when J-Link is selected (Init / Erase / Write / Read sequencing)?
Are there RAM regions that CubeProgrammer reserves for staging write buffers which the loader must avoid?
Is there a recommended linker memory layout / maximum loader RAM footprint?
Does CubeProgrammer call Init() multiple times during programming, and should Init() be designed to be fully re-entrant?
Are there guidelines on cache/MPU/XSPI memory-mapped mode usage inside external loaders?
Any recommended debug method to trace loader execution?
If anyone has successfully developed and used a custom STM32CubeProgrammer external loader with J-Link on STM32N6, I’d appreciate any checklist or lessons learned.
Thanks.