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.
2026-05-26 8:38 PM
Please check with Segger whether J-Link supports STM32N6.
J-Link software (J-Flash) has "universal driver" for xSPI flash. It is not compatible with CubeIDE but if there is support, you can program it via J-Flash.
2026-05-26 8:48 PM
Thanks for the suggestion.
J-Link does support STM32N655X0 and I’m able to connect, download to RAM, and execute code on the target through STM32CubeProgrammer using the J-Link interface.
The limitation I’m facing is not basic STM32N6 support in J-Link, but external flash programming support for my custom hardware.
I looked into J-Flash and the Universal Flash Loader approach. However, my board uses a custom XSPI flash connection / initialization sequence and there is no existing flash device configuration matching my board setup (pin assignment), so the generic J-Flash solution is not directly usable in my case.
That is why I’m currently trying to continue using a custom STM32CubeProgrammer external loader (.stldr), where I can fully control the XSPI initialization and flash operations.
My questions are mainly around whether CubeProgrammer behaves differently when executing .stldr loaders through J-Link versus ST-LINK (loader lifecycle, RAM usage, Init() invocation pattern, debugging recommendations, etc.), since erase currently works but write/read operations fail.
If there are any known limitations or recommendations specifically for CubeProgrammer + custom external loader + J-Link, I’d appreciate guidance.
Thanks.
2026-06-01 3:31 AM
Hello @ArunJohn
Please refer to the article below:
How to implement and use your own external flash l... - STMicroelectronics Community
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.