EmbeddedRelated.com
Forums

Doubt : Default value of Variables which are kept in NO_INIT location

Started by yadunandan kasu January 24, 2008
hi everyone,

can any one tell me the initial default value for the varibles
which are placed in the NO_INIT location by modifying the .prm file. I
am using Codewarrior for this.

I modifed my project .prm file, like below using NO_INIT, so
that the variables which are declared in the RAM area from 0x2000 to
2005 will not be initialized to zero by default.

when I download the code and debugging, I found it carries a max
value by default initially. (i.e if I declare a char variable, it
carries a value of 254).
That means, all the variables which are declared in this RAM
area will carry their max values...? or is that 254 is any garbage
value..?

please provide me the answer..

/* non-paged RAM */

My_Ram_Non_Init = NO_INIT 0x2000 TO 0x2005; /* vairbles in this
location will not be
initialized to zero */
My_Ram = READ_WRITE 0x2006 TO 0x3FFF;
Thanks & Regards
Kasu
Hi Kasu,

Is this for a S12X?
Variables allocated in NO_INIT segments are not written to by the
startup code, therefore the values are
either garbage, values written into it before or some otherwise by the
hardware defined values.
For RAM and after the power on startup, I would expect them to contain
garbage.

Daniel

yadunandan kasu wrote:
> hi everyone,
>
> can any one tell me the initial default value for the varibles
> which are placed in the NO_INIT location by modifying the .prm file. I
> am using Codewarrior for this.
>
> I modifed my project .prm file, like below using NO_INIT, so
> that the variables which are declared in the RAM area from 0x2000 to
> 2005 will not be initialized to zero by default.
>
> when I download the code and debugging, I found it carries a max
> value by default initially. (i.e if I declare a char variable, it
> carries a value of 254).
> That means, all the variables which are declared in this RAM
> area will carry their max values...? or is that 254 is any garbage
> value..?
>
> please provide me the answer..
>
> /* non-paged RAM */
>
> My_Ram_Non_Init = NO_INIT 0x2000 TO 0x2005; /* vairbles in this
> location will not be
> initialized to zero */
> My_Ram = READ_WRITE 0x2006 TO 0x3FFF;
> Thanks & Regards
> Kasu
>
>
Hi Daniel,

I agree with you,^^

I think the all the variables defined in the NO_INIT location carries some garbage value.

I checked by defining different variables in the NO_INIT locations in my project.

Thank you very much~
Kasu
Daniel Friederich wrote: Hi Kasu,

Is this for a S12X?
Variables allocated in NO_INIT segments are not written to by the
startup code, therefore the values are
either garbage, values written into it before or some otherwise by the
hardware defined values.
For RAM and after the power on startup, I would expect them to contain
garbage.

Daniel

yadunandan kasu wrote:
> hi everyone,
>
> can any one tell me the initial default value for the varibles
> which are placed in the NO_INIT location by modifying the .prm file. I
> am using Codewarrior for this.
>
> I modifed my project .prm file, like below using NO_INIT, so
> that the variables which are declared in the RAM area from 0x2000 to
> 2005 will not be initialized to zero by default.
>
> when I download the code and debugging, I found it carries a max
> value by default initially. (i.e if I declare a char variable, it
> carries a value of 254).
> That means, all the variables which are declared in this RAM
> area will carry their max values...? or is that 254 is any garbage
> value..?
>
> please provide me the answer..
>
> /* non-paged RAM */
>
> My_Ram_Non_Init = NO_INIT 0x2000 TO 0x2005; /* vairbles in this
> location will not be
> initialized to zero */
> My_Ram = READ_WRITE 0x2006 TO 0x3FFF;
> Thanks & Regards
> Kasu