Does I_MEM survive reset? #91
-
Does I_MEM survive reset? I assume D_MEM doesn't, but I assume I_MEM does. Is that correct? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I_MEM and D_MEM will behave the same in reset. If its "Worm Reset" Meaning VCC (Power) always is on and only the reset bit is triggered, the D_MEM & I_MEM will maintain their values. incase of a "cold reset" both D_MEM & I_MEM will have "garbage". (which is expected when we lose power. |
Beta Was this translation helpful? Give feedback.
-
Garbage in case of cold reset is acceptable. As for warm reset, the current behavior is problematic with global data: usually global variables are loaded into memory and usually the application won't explicitly initialize them. In our case, if a global variable was modified, its new value will remain after warm reset instead of the expected initial value. The easy solution I can think of is to document that all global variables must be explicitly initialized in global setup handler, but that's a bit of a pain. Also, the compiler may decide to add data section and use it as baseline (see the case of a big array, where ".rodata" section is created and data is copied from there). The more thorough solution I can think of is something like this:
|
Beta Was this translation helpful? Give feedback.
I_MEM and D_MEM will behave the same in reset.
If its "Worm Reset" Meaning VCC (Power) always is on and only the reset bit is triggered, the D_MEM & I_MEM will maintain their values.
incase of a "cold reset" both D_MEM & I_MEM will have "garbage". (which is expected when we lose power.