keil recursive reentrant
I would try to avoid reentrant functions if you are using a small microcontroller like 8051 or PIC.
Most of the time you can recode a function to not use reentrancy ...
This is from Keil C51 manual:
3
Reentrant Functions
A reentrant function can be shared by several processes at the same time. When
a reentrant function is executing, another process can interrupt the execution and
then begin to execute that same reentrant function. Normally, functions in Cx51
cannot be called recursively or in a fashion which causes reentrancy. The reason
for this limitation is that function arguments and local variables are stored in
fixed memory locations. The reentrant function attribute allows you to declare
functions that may be reentrant and, therefore, may be called recursively. For
example:
int calc (char i, int b) reentrant {
int x;
x = table ;
return (x * b);
}
Reentrant functions can be called recursively and can be called simultaneously
by two or more processes. Reentrant functions are often required in real-time
applications or in situations where interrupt code and non-interrupt code must
share a function.
As in the above example, you may selectively define (using the reentrant
attribute) functions as being reentrant. For each reentrant function, a reentrant
stack area is simulated in internal or external memory depending upon the
memory model used, as follows:
Small model reentrant functions simulate the reentrant stack in idata
memory.
Compact model reentrant functions simulate the reentrant stack in pdata
memory.
Large model reentrant functions simulate the reentrant stack in xdata
memory.
best regards