[Icc-avr] stack size needed to use fp?

Johannes Assenbaum jassenbaum at htp-tel.de
Tue Apr 29 12:33:04 PDT 2008


> Good clue Rich! So my whole problem could be sort of an fp underflow..... Wonder if
> I could hide an 0x55aa before and after the fp convert buffer and check for buffer
> overrun after cprintfs? Any idea how to find the address of the fp buffer?

> -----Original Message-----
> From: Rich Webb <webbra.mlist at verizon.net>
> To: icc-avr at imagecraft.com
> Sent: Tue, 29 Apr 2008 10:52 am
> Subject: Re: [Icc-avr] stack size needed to use fp?


>> Hello imagecraft users. I have had 'problems' with my programs going nuts > and
>> the common theme seems to be something to do with fp print or fp divide. > I'll
>> ask for forgiveness for using fp right now. But I'd like one or two folks > out
>> there to edit and compile a simple program using floats and %7.1f format > spec
>> and tell me if it runs ok with hw stack of 0x80 or the hw stack has to be > larger
>> to run. I've tried every stack size up to 0x400 and still get blowups > and
>> strings of garbage printed out. I can dump ram and see a repeating > pattern all
>> thru ram. This would obviously clobber the stack, but if this is a > 'bug', how
>> could it be in version after version and no one else run into it? If > its my
>> arcane programming style, then I need some help bad. Thanks for > reading.?
> ?
> Just guessing, but you may be overrunning your buffer space, since the printf()
> conversion routines return "ftoa error: number too big" (or "...small") if the
> target of the conversion is out of range.?
> ?
> It appears from a little experimenting that %f and %g hit the wall in sprintf()
> somewhere below 2E-9 and above 2E9, rather than handling the full E-38 to E+38
> range.?
> ?
> FWIW, this was with V7.16a with a stack size of 50 on an AT90CAN128 that I happened
> to have mounted for another project.?
> ?
> The fragment:?
> ?
> ? anum = 1.0;?
> ? bnum = 1.0;?
> ?
> ? while (1) {?
> ? if (tick) {?
> ? tick = 0;?
> ?
> ? anum *= 17.3;?
> ? bnum *= 1.3;?
> ?
> ? sprintf(buf, "%g / %g = %g\r\n", anum, bnum, anum / bnum);?
> ? ...?
> ? }?
> ? }?
> ?
> produces:?
> ?
> 17.299999 / 1.3 = 13.307691 ?
> 299.289947 / 1.69 = 177.094665 ?
> 5177.715332 / 2.196999 = 2356.721191 ?
> 89574.460937 / 2.856099 = 31362.523437 ?
> 1.549638e6 / 3.712928 = 417362.75 ?
> 2.680873e7 / 4.826806 = 5.554135e6 ?
> 4.637910e8 / 6.274847 = 7.391272e7 ?
> ftoa error: number too big / 8.157299 = 9.836079e8 ?
> ftoa error: number too big / 10.604487 = ftoa error: number too big ?
> ftoa error: number too big / 13.785831 = ftoa error: number too big?
> ?
> _______________________________________________?
> Icc-avr mailing list?
> Icc-avr at imagecraft.com?
> http://dragonsgate.net/mailman/listinfo/icc-avr?





More information about the Icc-avr mailing list