2026-02-03 10:44 AM
Hi!
I am making a custom external loader for my custom STM32F469 board equipped with a W25Q128 flash mermory on QuadSPI.
To do so I am using vscode and a CMake project generated via CubeMX.
I am able to generate and run programs on my STM32F469 (embedded flash), I can write, read and reset the external flash even using the memory mapped mode (verified through the debugger).
Now I want to build an external loader based on this project. I copied the files from the STM external loader Github (contrib branch), updated them to match the W25Q128 configuration, and added an executable to my CMakeLists file to compile (and most importantly link) the external loader.
My first problem is that the linker complains that there is no "main" function. I searched around for what could be the entry point of en external loader but I can't find anything. So I created a new main function (different from my application) with only an infinite loop (for the record I also made a return 0 main function which led to identical results).
The External Loader compiles, and I can paste it in the CubeProgrammer, which (after fiddling a bit) recognizes it well. But when I try to read the external memory it only works the first time. Any other command related to external memory fails (thus I can't program the external memory, CubeProgrammer can read the memory if it is the first command issued but the reset command after it fails). I have to click on "Disconnect" and "Connect" to the STLink for any other command to be working again.
Do you know why I observe such behavior? Is it related to the main function entry point used in building the External Loader?
Thanks a lot!