Showing results for 
Search instead for 
Did you mean: 

External nor flash partitioning

Associate II

I am using STM32L562E-DK that has an MX25LM512 external nor flash memory connected to the STM32 that uses OCTOSPI communication. I am using the example OSPI_NOR_ExecuteInPlace found in In the example, the linker script is modified as follows so that the function GpioToggle is written in the external memory and executed from there: 

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K
ROM (rx) : ORIGIN = 0x8000000, LENGTH = 512K
QSPI (xrw) : ORIGIN = 0x90000000, LENGTH = 65536K


/* For functions in QSPI memory */

_ospi_nor_init_base = LOADADDR(.ospi_nor);
_ospi_nor_init_length = SIZEOF(.ospi_nor);

.ospi_nor :
. = ALIGN(4);
_ospi_nor_start = .; /* create a global symbol at qspi start */
*(.ospi_nor) /* .ospi_nor sections */
*(.ospi_nor*) /* .ospi_nor* sections */
. = ALIGN(4);
ospi_nor_nor = .; /* define a global symbols at end of qspi */


Apart from executing GpioToggle from the external memory, I also want to mount a file syste (littleFS) on it. For this reason, I want to use half of the memory for writing GpioToggle (and potentially other functions) and half of the memory for the filesystem. Is this even possible? Or are there some blocking points? Should I change the linker script in this case or should I just play with the address range in the file system configuration?

ST Employee

Hello @Lyap94 and welcome to the Community 🙂,

It is possible to partition the external flash memory.

For that; please make sure that you load the filesystem at the right address.

Thank you.


To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.