cancel
Showing results for 
Search instead for 
Did you mean: 

H743: Handler variable appear both in RAM and Flash? Why

HMSEdinburge
Associate II

Hello.. i am writing a FD-CAN handler "fdcan1". I dun understand why it appears both in the micro's RAM and Flash? Can anyone advise? see screenshot for the memory detail.

 

 

1 REPLY 1
TDK
Super User

The initial value for non-zero global variables is stored in flash. When the program starts, they are copied to RAM. This is the expected behavior. They need to have space reserved for them in FLASH in order to store the initial value.

During program execution, the variable lives in RAM. It's location in FLASH is only accessed during program initialization.

In contrast, global variables which are zero-initialized do not take up any room in FLASH and only "live" in RAM.

If you feel a post has answered your question, please click "Accept as Solution".