Hi Team, I'm using a STM32L4R5 and am wanting to store variables in SRAM2 as static variables so that they hold their value while the micro is in standby mode with SRAM2 retention enabled. What am I missing?
I've followed every tutorial/thread that i've been able to find but cannot get this to work. I've set:
RAM2 (xrw) : ORIGIN = 0x20030000, LENGTH = 64K
and
.ram2_bss :
{
. = ALIGN(4);
*(.ram2_bss)
*(.ram2_bss*)
} >RAM2
In STM32L4R5ZITX_FLASH.ld and defined the variable as
static int __attribute__((section(".ram2_bss"))) nrOfWakeUps = 0;
In main.c. The nrOfWakeUps is incremented each time the micro wakes up and an IO line is toggled to reflect this as per:
while (1)
{
nrOfWakeUps++;
for(int i=0; i<nrOfWakeUps; i++){
GPIOA->BSRR = 0x00001111;
HAL_Delay(1);
GPIOA->BSRR = 0x11110000;
HAL_Delay(1);
}
if(nrOfWakeUps>5)
nrOfWakeUps=0;
SysTick->CTRL = 0; //Disable Systick
asm("WFI");
}
but i only ever get one pulse on the IO lines. What am i doing wrong?
Thanks in Advance!
Regards,
Peter