cancel
Showing results for 
Search instead for 
Did you mean: 

SRAM battery Backup

nanuradha
Associate II
Posted on July 30, 2007 at 12:32

SRAM battery Backup

4 REPLIES 4
nanuradha
Associate II
Posted on May 17, 2011 at 09:43

Hi all,

Can anybody tell me how to give battery backup to SRAM? Though I configured the PWR bit in the RTC control register, the SRAM contents are not retained after power reset. Plz help me. Its very urgent. Send an example code if possible.

Regards

Neelima.

nanuradha
Associate II
Posted on May 17, 2011 at 09:43

Hi all,

For retaining the values of the variable even after powerup, I've tried all the following :

1. Configured the pwr bit in RTC control register to provide battery backup for SRAM

2. Configured the SRAM as NoInit in the project-options-target menu.

3. Declared the variables as

a. __attribute((__zero_init)) u8 dummy1;

b. #pragma NOINIT

u8 dummy2;

But both the variables are not retaining their previous values after reset. Plz help me. Its vary urgent.

Regards,

Neelima.

[ This message was edited by: anuradha on 21-05-2007 11:31 ]

nanuradha
Associate II
Posted on May 17, 2011 at 09:43

Hi all,

while trying to write variables in the NoInit section of RAM, I found one strange thing. Any value written directly to the SRAM memory location like ''*(u8*)0x04007000 = 1'' is retaind even after power reset but the global variables declared are not. They are getting initialized to zero after power reset. Is it because they are declared as global? If so, what is the alternative way to declare global variables so that they can retain their values? And what area of SRAM will be allocated for stack?

Regards,

Neelima.

andy_ry
Associate II
Posted on May 17, 2011 at 09:43

Quote:

Any value written directly to the SRAM memory location like ''*(u8*)0x04007000 = 1'' is retaind even after power reset but the global variables declared are not. They are getting initialized to zero after power reset.

Hi Neelima. RTFM! In the current version of RVCT, the compiler might place small global ZI data items in RW data sections as an optimization. In RVCT 2.0.1 and earlier, small global ZI data items were placed in ZI data sections by default. Selecting the option --bss_threshold=0 instructs the compiler to place all small global ZI data items in the current compilation module in a ZI data section. ((c) ARM Development Tools)

[ This message was edited by: Andy_ry on 30-07-2007 16:54 ]