Skip to main content
Visitor II
August 14, 2024
Question

w25q128 external flash with stm32l412

  • August 14, 2024
  • 2 replies
  • 1109 views

Hi,

I am using stm32l412 controller with an external flash w25q128 in quadspi mode. I am able to read and write on to the flash memory. but I am unable to use it as an external loader. I referred many tutorials, I edited the linker script to add a section which created a space for external flash memory. 

I tried to add a data to that particular memory space but, it is not showing in the memory. I would like to load a bin file from my external flash but even a data cannot be loaded.

 

MEMORY

{

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 40K

RAM2 (xrw) : ORIGIN = 0x10000000, LENGTH = 8K

FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 128K

QSPI_FLASH (rx) : ORIGIN = 0x90000000, LENGTH = 16M

}

 

.extflash :

{

. = ALIGN(4);

_extflash_start = .;

*(.extflash) /* Place all sections with attribute .extflash */

*(.extflash*) /* Place any other sections with names that start with .extflash */

. = ALIGN(4);

_extflash_end = .;

} >QSPI_FLASH

 

 

    This topic has been closed for replies.

    2 replies

    Super User
    August 14, 2024

    To begin with - do you really need the external loader if you already can write to the flash? Can you just write a small utility (using semihosting, or UART or other external interface, maybe using compression to improve speed) to load your binary to the flash, and be done with it?

     

    Graduate II
    August 14, 2024

    >>I tried to add a data to that particular memory space but, it is not showing in the memory.

    Do you at least see it in the .ELF, .HEX or described in the .MAP output from the Linker?

    In order for STM32 Cube Programmer to deliver to your memory device it needs an External Loader that's familiar with your hardware, ie chip choices, pins, clocks, etc.

    Identify the PINS your QSPI device is using..

    Creating External Loaders is a bit of an exacting science, lots of ways to do it wrong, tutorials, videos, or not.

    They are hard to debug, but as you have a working BSP, it should be a shorter walk to fit within the framework of the external loader model. Diagnostics, well you can look at the Log at verbose level 3 for the PC side view, and output telemetry from your loader for the STM32 side view.

    hash002Author
    Visitor II
    August 19, 2024

    .extflash 0x0000000000000000 0x2 ./Core/Src/main.o

     

    .extflash 0x0000000090000000 0x0

    0x0000000090000000 . = ALIGN (0x4)

    0x0000000090000000 _extflash_start = .

    *(.extflash)

    *(.extflash*)

    0x0000000090000000 . = ALIGN (0x4)

    0x0000000090000000 _extflash_end = .

     

    I found the above lines in the map file.