Ok.
Since 3.2 the  section '.noinit' has been introduced.

Now from doc.txt #line 192:
.noinit
A RAM section, where uninitialized data resides. Located on a top of .bss
section, but data in this section leaved untouched on system start-up.

To initialize this you have to write some C (or assembler code), which copies 
data from rom to ram
__noinit_start, __noinit_end provide start and stop _ROM_ location of this 
section.
The main difference between '.noinit' section and any user defined section is 
that '.noinit' one will be located always at the top of bss.

If you want to copy whole section context to RAM, the following code should 
help:
        mov     #__noinit_start, r15
        mov     #__noinit_end+1, r14
        mov     #__bss_end, r13
.Lloop:
        mov.b   @r15+, @r13
        inc             r13
        cmp             r15, r14
        jnz             .Lloop


~d



On Monday 27 January 2003 09:21, Oleg Skydan wrote:
> 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 :).
>
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users

-- 
/********************************************************************
     ("`-''-/").___..--''"`-._     (\   Dimmy the Wild      UA1ACZ
      `6_ 6  )   `-.  (     ).`-.__.`)  Enterprise Information Sys 
      (_Y_.)'  ._   )  `._ `. ``-..-'   Nevsky prospekt,   20 / 44
    _..`--'_..-_/  /--'_.' ,'           Saint Petersburg,   Russia
   (il),-''  (li),'  ((!.-'             +7 (812)  3468202, 5585314
 ********************************************************************/


Reply via email to