[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] strlen() returns erroneous values
From: |
Parthasaradhi Nayani |
Subject: |
Re: [avr-gcc-list] strlen() returns erroneous values |
Date: |
Sat, 4 Jun 2005 11:39:46 -0700 (PDT) |
Hello Kits,
Yes constant strings are copied from ROM to RAM at
startup and indeed RAM is consumed at this point.
Therefore is it better to use strings in ROM/FLASH as
this would save RAM.
Regards
Nayani P
--- Kitts <address@hidden> wrote:
> On Saturday 04 Jun 2005 1:01 am IST, Kitts wrote:
> > Hi All,
> >
> > Are there any special considerations to take care
> of when using the
> > function strlen()? The function does not always
> return the right
> > values. Some times it appears to skip a NULL
> character and reaches
> > out to the next following NULL.
> >
> > I am multitasking on the AVR and from the avr-libc
> documentation i
> > found the function to have the "_ATTR_PURE_"
> attribute. Could this be
> > the cause for the problem? What does this
> attribute signify anyway?
>
> After a little fiddling around this is what i have
> found.
>
> When i use the strlen() function inside another
> function such that its
> output is the argument for the function i would get
> erroneous values
> for strlen. When i can functions in this manner, the
> call stack is
> probable large. The default thread stack size 0f 85
> bytes was not
> enough.
>
> Either increasing the thread stack size or
> separating out the functions
> such that only variables are directly set as
> arguments to the function
> helped me solve this problem.
>
> Now this leaves me with a doubt of how constant
> strings are managed? Are
> they loaded into RAM right at startup or at the time
> when they are
> used? Loading all constant strings to RAM at startup
> would
> unnecessarily consume a lot of RAM.
>
> --
> Cheers!
> Kitts
>
>
>
> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden
>
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
>
__________________________________
Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail