cancel
Showing results for 
Search instead for 
Did you mean: 

External Memory Loader

Louise
Associate II

Hello,

I want to learn how to write my own octospi external memory loader in STM32CubeIDE. I found example on https://github.com/STMicroelectronics/stm32-external-loader/tree/main/STM32H7x_boards/MX25LM51245G_STM32H735G-DK but project is built with EWARM or MDK-ARM IDE.

I generated new project and configured octospi interface in CubeIDE. Then I added files from this repository to communicate with the memory. Then I copied linker file from this repository: https://github.com/STMicroelectronics/stm32-external-loader/tree/contrib/Loader_Files/H7%20device

I generated .stldr file according to this video: https://www.youtube.com/watch?v=XqCq0xtQmbI&t=2s&ab_channel=STMicroelectronics, but when I added this file to STM32CubeProgrammer it shows error: Data read failed.

I know that octospi interface is configured well because I can write bytes to memory and then read it by default external loader. I can also read mem ID which is C2 85 3A

Whether these problems are caused by the linker file or should I change anything else in the project?

Is there any way to convert IAR project to STM32CubeIde project?

Best Regards

1 ACCEPTED SOLUTION

Accepted Solutions
Louise
Associate II

Thanks for your reply,

I have already solved the problem. I changed #define KeepInCompilation __root to #define KeepInCompilation __attribute__((used)) instead of deleting it.

View solution in original post

2 REPLIES 2

This is my GNU/GCC linker script, for the loaders I build via a makefile and the tools directly. I'm not using CubeIDE

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

The loaders don't start/enter via the startup.s / main() route, consequently the data/bss sections will not be moved or the zero-space initialized. Be wary of this

Porting from IAR or KEIL shouldn't be too difficult. The loader projects are pretty flat, most of mine contain the HAL include files, a handful of HAL source files, and a pair of loader source files.

Debugging of the loader can't be done directly, you'd either need to wrap it in some harness or instrument it to use interfaces on your board.

Notes to self

    OCTOSPI1 GPIO Configuration
 
    PF10     ------> OCTOSPIM_P1_CLK AF9
    PG6      ------> OCTOSPIM_P1_NCS AF10
    PB2      ------> OCTOSPIM_P1_DQS AF10
    PD11     ------> OCTOSPIM_P1_IO0 AF9
    PD12     ------> OCTOSPIM_P1_IO1 AF9
    PE2      ------> OCTOSPIM_P1_IO2 AF9
    PD13     ------> OCTOSPIM_P1_IO3 AF9
    PD4      ------> OCTOSPIM_P1_IO4 AF10
    PD5      ------> OCTOSPIM_P1_IO5 AF10
    PG9      ------> OCTOSPIM_P1_IO6 AF9
    PD7      ------> OCTOSPIM_P1_IO7 AF10

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

Thanks for your reply,

I have already solved the problem. I changed #define KeepInCompilation __root to #define KeepInCompilation __attribute__((used)) instead of deleting it.