[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Avoiding memory initialization
From: |
Lai Kang Tin |
Subject: |
Re: [avr-gcc-list] Avoiding memory initialization |
Date: |
Fri, 19 Oct 2001 23:38:07 +0800 (HKT) |
Hi,
I am sorry, it isn't working. You need not to modify anything, the simplest
way to do it:
extern unsigned __bss_end;
char *pointer = (char *)(&__bss_end + 1);
void func()
{
*pointer = 0x12;
*(pointer + 1) = 0x34;
...
}
The storage between __bss_start and __bss_end is for all variables of you
application, and will be zero by C startup code of avr lib. After __bss_end
to the rest of RAM, it is free for you.
Cheers!
kang Tin LAI
On Fri, 19 Oct 2001, Lai Kang Tin wrote:
> Hi,
>
> There is a loop inside the C startup code for zeroing the bss segment,
> to realize your requirement, you need to modify the C startup code
> for your own. The startup code uses symbol __bss_end to stop the zeroing loop,
> you change it to (__bss_end - 10), ten bytes assumed for your application.
>
> To access these 10 bytes storage, use pointer in your codes:
>
> extern unsigned __bss_end;
> char *pointer = (char *)(&__bss_end - 10);
>
> void func()
> {
> *pointer = 0x12;
> }
>
> Cheers!
>
> Kang Tin LAI
>
> On Wed, 17 Oct 2001, [iso-8859-1] S S wrote:
>
> > Hello Everybody,
> >
> > I am using Atmega103. I have declared an array of char
> > which I do not wish to get initialized on every CPU
> > reset signal. I am keeping some acquired data here. In
> > short I want to use this array as battery backed up
> > RAM. However startup code clears the entire bss
> > section on every reset signal. Is there a way to avoid
> > this? Can somebody provide me source code to do the
> > same?
> >
> > Thanks.
> > Sean.
> >
> > ____________________________________________________________
> > *NEW* Connect to Yahoo! Messenger through your mobile phone *NEW*
> > Visit http://in.mobile.yahoo.com/smsmgr_signin.html
> >
> > _______________________________________________
> > avr-gcc-list mailing list
> > address@hidden
> > http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list
> >
>
> K.T.LAI
> address@hidden
>
>
>
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list
>
K.T.LAI
address@hidden