2025-07-07 6:23 AM
Hello,
I am trying to make an external loader for a STM32H5 to program a QSPI flash MX25L12835F with STM32 Cube Programmer.
In my project I add files Dev_inf.c .h ans Loader_Src.c .h from :
And modify them to adapt to my board :
- Dev_inf.c : update StorageInfo struct
- Loader_src.c : reimplement Init() , MassErase() , Write(), SectorErase() with my flash driver.
I test these functions in debug with the original linker STM32H562RGTX_FLASH.ld and these functions works ok.
After I change the linker file with linker.ld of the branch contrib stm32-external-loader\Loader_Files\other devices and build and generate the file .stldr and put it into STM32CubeProgrammer\bin\ExternalLoader
Then when I open STM32CubeProgrammer I see my external loader in the list :
But when I try to read or erase at QSPI address 0x90000000 I get an error immediatly and nothing happens on the QSPI bus signals like if the functions are not executed :
Does anyone have an idea of what I forgot to do ?
Thanks,
2025-07-10 2:15 AM
Hello @lallain and welcome to the community;
I recommend you to look at MOOC - External QSPI loader how to - YouTube and get inspired to check your configuration.
Which VTOR address are you using? I think this discussion can help you: Solved: Files for STM32H563 External Loader - STMicroelectronics Community
I hope this help you!
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-09-03 6:08 AM
Hello @KDJEM.1 ,
Thanks for your answer,
I have look at the MOOC but didn't find the solution
I am using :
Init() : SCB->VTOR = 0x20003000 | 0x200;
linker.ld : RAM (xrw) : ORIGIN = 0x20003004, LENGTH = 512K-12292
The error in STM32Cube Programmer is the init function that fail directly:
15:03:20:870 : Read progress:
15:03:20:871 : Reading data...
15:03:20:871 : Init flashloader...
15:03:20:871 : Init function fail
15:03:20:876 : Error: Data read failed
I try to empty the Init function and only return 1 (=LOADER_OK) and have the same behavior.
In put my file Loader_Src and linker.ld in attachement
Do you see something wrong ?
Thanks
2025-09-03 2:44 PM
Try to avoid "external loaders" and use your own code to put the data on the ext. flash.
There are too much trouble with these loaders, they are too fragile.
2025-09-03 3:09 PM
Likely the functions Init() is calling that fail or return errors.
If you have a UART you can use that to instrument the code to understand what's happening.
The alternative is to make a test-harness to interact and test the functions from within an application which you can run on a debugger.
What's your pin utilization for the external memory?
2025-09-04 1:57 AM
Thank you @Pavel A. and @Tesla DeLorean for your answers,
@Pavel A. I wanted to use the ST external loader to have a quick solution to program the external memory and using it when degugging under STM32 Cube IDE
@Tesla DeLorean It seems that the code is not executed when using STM32 Cube Programmer, I try to simply toggle a GPIO in Init() function and it is not working I've immediatly the Init function fail error.
(I verified before that it works in debug with the standard linker file STM32H562RGTX_FLASH.ld and without changing VTOR as well as all other functions I used)
My pin utilisation for the external memory is : (STM32H562RGT LQFP64)
22 PA6 OCTOSPI_IO3, 23 PA7 OCTOSPI_IO2, 26 PB0 OCTOSPI_IO1, 27 PB1 OCTOSPI_IO0, 28 PB2 OCTOSPI_CLK, 29 PB10 OCTOSPI_NCS
Do you have an idea of what could be the problem ?
Thanks,