2021-01-12 06:04 AM
I am trying to develop an external loader for an SPI Nor flash and i am not being able.
All the documentation is referred to QSPI. In the TouchGFX documentation the S25FL032P_STM32G071B-NUCLEO.stldr loader is mentioned for this purpouse. However, i could not find the source of this project to serve as example.
Finally, i have tried to develop my own loader and the testing of the flash is correct, but if i try to use it through CubeProgrammer it fails. The log file changes a lot with small changes in the code...I have tried to only fill the Init() function and left blank the EraseSector and Write functios and even in those cases the log file shows that the EraseSector has failed...
I would really appreciate any help!
2021-01-12 06:52 AM
Well, not literally a help but an alternative: OpenOCD with this patch http://openocd.zylin.com/#/c/4760/
2021-01-12 06:54 AM
Use SPI_FLASH type, NOR_FLASH indicates a memory mapped F(S)MC or QSPI memory
Check the .MAP file to see which function it is calling via PC.
Given that it failed immediately (time stamp), I'd guess you just faulted the CPU, the call didn't look to return, and the tool might have tried to read the memory directly.
The External Loaders are certainly things you can throw hours/days at.
If you have a UART you can use that as a diagnostic/telemetry channel. You might also want to create a test harness to validate all the functions in an environment you can test and debug them.
https://community.st.com/s/question/0D53W00000QtoMtSAJ/source-code-for-stm32g071r-external-loader
2021-01-12 10:37 PM
I did not know anything about OpenOCD but i am going to learn more and give it a try! Thank you very much. I will inform if i get it to work..
2021-01-12 10:48 PM
Thank you very much!
The flash i am using is the SST26 from Microchip, that can work with QSPI but also in SPI mode.
I have checked the .MAP file and it seems to fail in the SectorErase function:
What bothers me is the fact that if i left the function empty, as i show in the next figure, it halts in the same way.
What could i debug with de UART? I have tried to toggle one GPIO output in the Init function to see if it was being executed and had no effect... I have tested this functions debugging in the main.c and they worked.
I really would like to go for a STM32F4 and use a tested loader with the QSPI driver but it is for a company that has developed a custom board with a STM32F3 and wants to use TouchGFX...
Again, really thankful!
2021-01-26 05:59 AM
In case is useful for someone, i finally managed to complete the loader. I was having problems because i had no set the correct RAM size of my board in the linker file. Besides, i also had some troubles because my verification was failing only in some cases. in the end it was due to the fact that those binaries were bigger than my flash size, so it was being overwritted.
2021-01-27 11:08 PM
hi Kjilguero:
I am trying to develop an external loader for an SPI flash ,I looked at your loader_project, when i config properties ,select dicard unused sections ,can build .stdrl file ,but use stm32cubeprogrammer open this file is error.
it seems to fail in the SectorErase function:
when i don't ,select dicard unused sections,use stm32cubeprogrammer open this file is ok,but when i programming i have the same problem as you,
it seems to be no runnig Init() Read() Write() MassErase() CheckSum() Verify() function.
How do you make these features work?
Can you tell me what your first loader_project problem was? How should I configure properties?
Can you talk to me about the problem in my project,
Thank you very much!
2021-01-28 01:09 AM
Hi,
You have to deselect "discard unused sections", other way the compiler will erase the functions defined in Loader_src, as they are not being used. In my case i had not enough memory to deselect this option so what i did was calling these functions in the main loop. This way the compiler does not erase them because they are being "used". In order to see if that functions are being called from the stm32cubeprogrammer you can select the option "Verbosity level 3" in this program and see the memory address being called and compare them with the ones of the memory .map of your project. My first and only loader project is the one that i have attached previously. Good luck!!