Hello, All !

I have a ittle problem and hope you can help me.

I have several variables that resides in RAM and I use a battery to store
the RAM content.

How I should declare them to prevent startup initialization ?
At this moment I use:
int __attribute__((section(".xxxx"))) var;
It work, but I am not sure that it is right :).

Time to time (for example when battery fails) I need to initialize all (or
some) of those variables
with default values. Suppose I have the next code:

int a=1;    //this should be initialized every time the reset occures
int x=10;  //this should not be initialized when reset occures - only when I
need it
int b=2;    //this should be initialized every time the reset occures
int y=20;  //this should not be initialized when reset occures - only when I
need it

By default all those variable will be put to the .bss segment, and initial
values will be stored
in the flash and copied at startup to the RAM.

I need to group some of the variables to the different segment, that behaves
like .bss (but
values are copied not at startup, but when I need). If I will do it I will
be able to quickly
initialize them (as _reset_Vector does), but only when I need to do it :).

If you have any suggestions I would be very grateful to you.

Do not think that I can just write x=10 :) when I need to initialize x , I
have >1K of variables having different
types defined in different files, so it is not acceptable.

Thanks, Oleg.
P.S. My thoughts could be unclear, so feel free to ask me :).


Reply via email to