cancel
Showing results for 
Search instead for 
Did you mean: 

External QSPI Flash Memory (memory-mapped) and internal RAM

hesam moshiri
Associate III

Hello,

I have configured an External flash for the F412 chip. So I modified the STM32F412RETX_FLASH.ld like this:

MEMORY
{
  RAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 256K
  FLASH    (rx)    : ORIGIN = 0x8000000,   LENGTH = 512K
  QUADSPI (r)    : ORIGIN = 0x90000000,  LENGTH = 4M 
}
 
...
...
...
 
.ARM.attributes 0 : { *(.ARM.attributes) }
  
  ExtFlashSection :
	{
		*(ExtFlashSection ExtFlashSection.*)
		*(.gnu.linkonce.r.*)
        . = ALIGN(0x4);
	} >QUADSPI
}

Configured the QSPi for the memory-mapped and assigned an array like this to the external flash:

#define LOCATION_EXTFLASH_ATTRIBUTE __attribute__ ((section ("ExtFlashSection"))) __attribute__ ((aligned(4)))
 
uint8_t logo_143x78_map[] LOCATION_EXTFLASH_ATTRIBUTE = {
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit*/
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x30, 0x00, 0x40, 0x00, 0x58, 0x00, 0x70, 0x00, 0x88, 0x00, 0xa0, ........};

It works and I see the equipped memories like this:

0693W00000APLfFQAX.jpg 

However I see when I assign the data to the external memory, the RAM usage also descreases which I think it should not be like this, we have only changed the location of the data.

Is this normal?

1 ACCEPTED SOLUTION

Accepted Solutions

Use "const"

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

View solution in original post

2 REPLIES 2

Use "const"

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

That's it. Solved. Thanks.