cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G070: External Loader Created but not Working

RenjithGopan
Visitor

Hi @stm32 

I have a STM32G070 chip connected to a NOR_FLASH MX25L6433F using Standard SPI. I created an External Loader for the setup, but unable to read/write using the stm32 programmer. The custom driver for the particular flash is proved to work with the same hardware setup, so i can confirm that the bridging between the working driver and the STM2Programmer is somewhat missing. 

I created an External loader from scratch following the STM32 MOOC course link (https://www.youtube.com/watch?v=xASKxhqphkk&list=PLnMKNibPkDnHIrq5BICcFhLsmJFI_ytvE&index=4) for QSPI.

Steps I followed:

1) Created a CubeMx project for stm32g070 with SPI enabled in my case.

2) Manually copied the loader files from the link https://github.com/STMicroelectronics/stm32-external-loader/tree/contrib/Loader_Files and also integrated my custom driver for the particular NOR_FLASH. The driver is tested and verified separately,So it works.

3) In the build configurations, pasted the command cmd.exe /C copy /Y "${BuildArtifactFileBaseName}.elf" "..\${BuildArtifactFileBaseName}.stldr" to create stldr.

 

Please note that the .stldr is created properly because the members of the StorageInfo Struct including the Name, Device Start Address, Memory Size, Page Size and the Type etc are displayed in the STM32Programmer EL tab. However, after some testing i came to the conclusion that the functions Init, Read,Write in the Loader_Src.c is not being called.

 

I request you to help me with some hints or it is more helpful if you can give an External Loader project template/ Starting point for the STM32G0 series, so i can start adapting that starter project according to my pin changes and my specific external flash. Please find the linker.ld, the startup file, Loader_Src.c and Dev_Inf.c/.h file I use for my project for your reference. Also find the screenshot after the .stldr is loaded in the stm32programmer.

 

Best Regards,

Renjith Gopan

6 REPLIES 6

Need to be using SPI_FLASH type rather than NOR_FLASH

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hi @Tesla DeLorean ,

 

Tried using the SPI_FLASH at first indeed. But upto my understanding, the change of the Device Type to SPI_FLASH just made the STM32Programmer to recognise the .stldr Device Type as SPI_FLASH instead of NOR_FLASH. I am more concerned about the linker.ld or the startup.s file not configured properly. Maybe the Entrypoint of the program is not pointing to the Init function eventhough specified so in the linker.ld 

In fact I used the linker.ld from the STM32 github, so i am thinking the linker.ld is somewhat reliable, but still regarding the startup.s, I am not sure if i have configured it properly.

It would be good if @Tesla DeLorean , or anyone could review those file attached,  or otherwise provide a template for the project if someone has already a working external Loader setup for G0,

 

Thanks for the Reply,

Renjith Gopan

NOR_FLASH expects the device to be Memory Mapped rather than use Read()

You can use a GPIO/LED and UART to provide diagnostic output from within the loader.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thanks @Tesla DeLorean ,

Yes i used a led to toggle inside the Init and Read function, that is how i realised the external Loader which i created is not calling the Init or Read function.

However, i cant actually say at this point, why these functions are not being called even after specifying the Entrypoint as Init.

 

Best Regards,

Renjith Gopan

 

The Linker Script should have RAM at 0x20000004, the programmer uses the first 4-bytes for a BL / POP LR type sequence

For my GNU/GCC + MAKE builds I use this form

https://github.com/cturvey/stm32extldr/blob/main/ExternalLoader_G4.ld

You can inspect the ELF file with OBJDUMP or FROMELF type tools to confirm the code, symbols and entry point.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

If using interrupts, you'll need to make special effort to keep the Vector Table aligned. The M0+ this probably isn't 512-byte, byte at least 256-byte aligned

 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..