Skip to main content
hesam moshiri
Associate III
May 23, 2021
Solved

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

  • May 23, 2021
  • 2 replies
  • 1508 views

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?

This topic has been closed for replies.
Best answer by Tesla DeLorean

Use "const"

2 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
May 23, 2021

Use "const"

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
hesam moshiri
Associate III
May 23, 2021

That's it. Solved. Thanks.