Are standard library routines -- long divide, delay, floating point arithmetic, sqrt, etc -- reentrant? Other than timing considerations is there any reason to avoid library calls in an ISR? I'm concerned of possible problems if I call the same library in both the main code and an ISR.
Look at the implementation. If the function declares local variables, the answer is likely no. Also keep in mind, some CPU registers may be reset depending on the mechanism your using for re-entrancy which in of itself may invalidate the results of a calculation. I don't remember where I read it, but I did find re-entrancy is not supported. That's not to say you can't get it to work with a subset of functions, but extreme caution is advised.
There be dragons ahead.
Where can I find the source for routines like long divide and sqrt?
You need to do a search. My understanding is its all open source so it shouldn't be too hard to track down.
If the function declares local variables, the answer is likely no.
Most functions are going to declare local variables.
The problems may come if they're static.
I'd be surprised if division or sqrt were not reentrant.
http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_reentrant
and
http://lists.gnu.org/archive/html/avr-gcc-list/2008-04/msg00047.html
Avr-gcc's division, multiplication are reentrant.
Avr-libc's float point operations are reentrant.
Avr-libc 1.6 math functions are reentrant: the errno
variable is not changed (modern C standart permits this).
AWOL:
If the function declares local variables, the answer is likely no.
Most functions are going to declare local variables.
The problems may come if they're static.I'd be surprised if division or sqrt were not reentrant.
Static or global. I completely fubar'd that. Thanks.
Avr-gcc's division, multiplication are reentrant.
Avr-libc's float point operations are reentrant.
EXACTLY what I wanted to know. Thanks!