Skip to main content
Mani1
Associate III
May 25, 2021
Solved

How to use flash memory address for particular variables?

  • May 25, 2021
  • 3 replies
  • 3387 views

STM32F469I discovery board.

How to use internal flash memory address for a particular variables? it's possible ?

I am struggled with this issue.

i am beginner of stm32. help me.

This topic has been closed for replies.
Best answer by TDK
Yes, that makes much more sense.
See here how to add a linker section and put variables there:
https://www.openstm32.org/Using%2BCCM%2BMemory
Use QSPI memory address rather than CCMRAM as in the example.

3 replies

Tesla DeLorean
Guru
May 25, 2021

Not exactly clear what exactly you're trying to achieve here.

P​lacement of constant data, via attributes and linker script sections?

O​r writing semi-permanent data or configuration into section of the flash memory?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Mani1
Mani1Author
Associate III
May 25, 2021

File: mani.c

unsigned short int FlashArray[8192] __attribute__ ((at((uint32_t)0x08004000)));

File :STM32F469NIHX_FLASH.id

.user_data (NOLOAD) :

{

. = ALIGN(4);

*(.user_data) /* .buffram section */

. = ALIGN(4);

} >FLASH

Tesla DeLorean
Guru
May 25, 2021

I'd probably avoid the AT method and use a C pointer method​, where you make a hole in the FLASH sections in the linker script, with an initial section for the vector table and some initialization code to be directed into.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Mani1
Mani1Author
Associate III
May 25, 2021

Thanks for your reply. I tried this logic also ,

main.c

const unsigned short int FlashArray[10] __attribute__((__section__(".user_data")));

File :STM32F469NIHX_FLASH.id

CCMRAM  (xrw)  : ORIGIN = 0x10000000,  LENGTH = 64K

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

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

 SDRAM (rw)   : ORIGIN = 0xC0000000, LENGTH = 16M

 QSPI (r)    : ORIGIN = 0x90000000, LENGTH = 16M

.user_data (NOLOAD) :

{

. = ALIGN(4);

*(.user_data) /* .buffram section */

. = ALIGN(4);

} >FLASH

TDK
May 25, 2021

Putting an uninitialized array into flash makes no sense. Flash cannot be used as RAM. You didn't answer Tesla's question on what you are trying to achieve.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Mani1
Mani1Author
Associate III
May 26, 2021

can i allocate QSPI memory for my uninitialized array? instead of RAM?

TDK
TDKBest answer
May 26, 2021
Yes, that makes much more sense.
See here how to add a linker section and put variables there:
https://www.openstm32.org/Using%2BCCM%2BMemory
Use QSPI memory address rather than CCMRAM as in the example.
"If you feel a post has answered your question, please click ""Accept as Solution""."