I have to write an external loader that is capable of programming a QSPI flash. My hardware design is mostly the same as the STM32F769I-Discovery board. However the pin configuration is different.
To understand the process of programming an external flash I tried to implement the external loader for this development board on my own. Unfortunately, ST does not deliver the code for this external loader.
Using the example N25Q256A_STM32L476G-EVAL_Cube for the L4 processor I managed to write an external loader that is able to run the library funtion Init() and reads the content of the QSPI directly to the ST-Link utilty.
I have observed that I can not use any interrupts and that the global variables are not zero'd, since __main() (Keil compiler) is not called in such an project.
So one of the problems I observe is the following.
When I try to erase a sector ST-Link reports an error:
External memory sector 0x90010000 is not erased. Verify the memory protection.
However after refreshing the content view, I can see that the sector was erased properly. I have also observed that the callback function Erase() terminates properly. I am using the LEDs as feedback.
After erase Verify() was not called so I thought that ST-Link reads the memory back. I had no luck with disabling and re-enabling the memory mapped mode of the QSPI within the Erase() function.
Writing a binary works for 7 pages but it then stops working and fails.
Do you have any experiences writing an external loader on your own?
Do you have any hints on how to bring erase and write to an success?