SRAM2 is only partially retained
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-07 2:36 AM
Hello dear STM32-Community,
I'm using an STM32L4R and wanted to configure my data retention of SRAM2 for standbymode.
I did the following changes to the linker file:
/* Highest address of the user mode stack */
_estack = 0x10004000; /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x800; /* required amount of heap */
_Min_Stack_Size = 0x800; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K
SRAM2 (rw) : ORIGIN = 0x10000000, LENGTH = 16K
}
[........]
.data :
{
. = ALIGN(8);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
. = ALIGN(8);
_edata = .; /* define a global symbol at data end */
} >SRAM2
As seen on the screenshot the data is acutally saved in SRAM2 (0x10000000) but except for counter, which is specifically initalized with
volatile uint32_t Counter __attribute__((section(".sram2")));
everything else is reset after restarting the programm. What am I doing wrong? Or do i have to manually enter every variable to sram2 myself?
Kind regards and thank you in advance
crackl1ng
Solved! Go to Solution.
- Labels:
-
STM32L4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-07 6:06 AM
> but except for counter, which is specifically initalized with
> volatile uint32_t Counter __attribute__((section(".sram2")));
> everything else is reset after restarting the programm.
How are other SRAM2 variables initialized.
Is SRAM2 marked as NOLOAD?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-07 6:06 AM
> but except for counter, which is specifically initalized with
> volatile uint32_t Counter __attribute__((section(".sram2")));
> everything else is reset after restarting the programm.
How are other SRAM2 variables initialized.
Is SRAM2 marked as NOLOAD?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-07 7:46 AM
The others are just initialized like usual:
float temp = 0.0f; and so on. As stated in the linker file, they are saved in 0x1000000.
And what does NOLOAD mean and where do I find that?
Thank you for your reply.
​
Kind regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-07 7:51 AM
Google?
Similar to NOINIT (don't initialize)
So that code in startup.s doesn't zero or copy in statics you don't want initialized.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-07 8:01 AM
