I've got a problem understanding how "SLEEP Mode with turned off RAM" works ...
There is an STM32 that my friend used in his project (still don't have it physically the board), and it had this option to use SLEEP mode without RAM.
I know how Sleep mode works. When wake up MCU from SLEEP Mode it starts from the place it entered the SLEEP mode.
But with turned of RAM will it not be cleared ? Hence The whole program is restarted ? And the program will start from including first "main.h" till the main function ? As if it restarted the MCU. These are my thoughts. Because with cleared RAM all variables, context of a program etc are cleared.
Used STM : STM32L031G6.
This is what is says in Datasheet :


STANDBY Mode also when it is woken up it restarts the whole program. So I am confused to be honest when I see similarities in both modes that I can't see the difference.
Can somebody help me explain how it works ?
I would like to test it but I don't have the board + I don't know how to turn this function in HAL functions (if it's possible).
Also the website says something about STOP mode also with Disabled RAM :

Stop mode can be waken up with EXTI, or any other that causes Callback. But how can it does a Callback when RAM is cleared ? It will see a variable that has some trash data, and what it will do when it executes the callback ? Where it will go back if the context if wiped because RAM is cleared ???
I am so confused ...
There is an STM32 that my friend used in his project (still don't have it physically the board), and it had this option to use SLEEP mode without RAM.
I know how Sleep mode works. When wake up MCU from SLEEP Mode it starts from the place it entered the SLEEP mode.
But with turned of RAM will it not be cleared ? Hence The whole program is restarted ? And the program will start from including first "main.h" till the main function ? As if it restarted the MCU. These are my thoughts. Because with cleared RAM all variables, context of a program etc are cleared.
Used STM : STM32L031G6.
This is what is says in Datasheet :


STANDBY Mode also when it is woken up it restarts the whole program. So I am confused to be honest when I see similarities in both modes that I can't see the difference.
Can somebody help me explain how it works ?
I would like to test it but I don't have the board + I don't know how to turn this function in HAL functions (if it's possible).
Also the website says something about STOP mode also with Disabled RAM :

Stop mode can be waken up with EXTI, or any other that causes Callback. But how can it does a Callback when RAM is cleared ? It will see a variable that has some trash data, and what it will do when it executes the callback ? Where it will go back if the context if wiped because RAM is cleared ???
I am so confused ...
