Let say a MCU has Flash and SRAM memory. While compiling a program, I specify the main function program code to be located in SRAM (this is done by modifying the linker script). After load the binaries to the MCU. The MCU runs properly. I was wondering what kind of things are happening when the RESET/REBOOT is occurred. Since SRAM is a volatile memory, it will lose data when it is not powered. I am not familiar with how the linker script is used to map the program code to an memory address.
Some references will be really helpful. Thanks!