ERROR MESSAGE !!!!!Function must be reentrant !!!!!!!!!!!!!!

General discussion on RSC-4x mikroC.
Post Reply
Author
Message
massebob
Posts: 5
Joined: 12 Mar 2007 10:41

ERROR MESSAGE !!!!!Function must be reentrant !!!!!!!!!!!!!!

#1 Post by massebob » 29 Mar 2007 14:05

I have the mikroe C compiler for RSC 4xxx and in particular for the RSC4x Development Board. I would like to call a C function in an interrupt function like this :
void Timer3_ISR(void)
{
initBTN(); // scrutation of the Button

if (timer3Ctr) // don't count down past 0
timer3Ctr--; // count down static variable
//init();
irq = ~T3_MASK; // clear the interrupt
//
}

void initBTN(void)
{

btn[0]=BTN1;
btn[1]=BTN2;
btn[2]=BTN3;
btn[3]=BTN4;
if(btn[0]==1||btn[1]==1||btn[2]==1||btn[3]==1) general();

}

general() is a function of my .c file.
I have declared all function in a .h file and I have this message :
Function <function_name> must be reentrant.
So I declared all function reentrant by using #pragma reentrant <function_name> but I have the same error with function which are used for speech recognition (like _T2SI or _DelayMilliSecs) and for the functions from <stdlib.h> library.
How can I call my function without error messages.
Thanks for your answer.

User avatar
rajkovic
mikroElektronika team
Posts: 694
Joined: 16 Aug 2004 12:40

Re: ERROR MESSAGE !!!!!Function must be reentrant !!!!!!!!!!

#2 Post by rajkovic » 02 Apr 2007 12:32

massebob wrote:I have the mikroe C compiler for RSC 4xxx and in particular for the RSC4x Development Board. I would like to call a C function in an interrupt function like this :
void Timer3_ISR(void)
{
initBTN(); // scrutation of the Button

if (timer3Ctr) // don't count down past 0
timer3Ctr--; // count down static variable
//init();
irq = ~T3_MASK; // clear the interrupt
//
}

void initBTN(void)
{

btn[0]=BTN1;
btn[1]=BTN2;
btn[2]=BTN3;
btn[3]=BTN4;
if(btn[0]==1||btn[1]==1||btn[2]==1||btn[3]==1) general();

}

general() is a function of my .c file.
I have declared all function in a .h file and I have this message :
Function <function_name> must be reentrant.
So I declared all function reentrant by using #pragma reentrant <function_name> but I have the same error with function which are used for speech recognition (like _T2SI or _DelayMilliSecs) and for the functions from <stdlib.h> library.
How can I call my function without error messages.
Thanks for your answer.
this is a part of the help:

"The reentrant function call requires additional overhead. Moreover, the support for reentrant functions results in the following restrictions that violate the C standard:
Total size of reentrant function parameters must not exceed 4 bytes, since the _tempArea field of GlobalRegisterArea is used for passing the reentrant function parameters.
Reentrant functions with ellipsis (variable number of arguments) are not supported.
A reentrant function return value cannot have a structure type, i.e. reentrant function cannot return a structure (but can return a pointer to structure).
Local objects (automatic variables and actual function parameters) of the previous invocations of reentrant functions are inaccessible from the current reentrant function
invocation (because they can be overwritten by the current reentrant function frame, see Compiled Stack for details).
Also, only local objects of the last invocation of reentrant function
can be accessed from non-reentrant functions."
like _T2SI or _DelayMilliSecs) and for the functions from <stdlib.h> library.
here is the declaration of _T2SI :

Code: Select all

uchar _T2SI( long acousticModel, long grammarModel, uchar knob,
             char timeout, uchar trailing, PARAMETERPASS *pRes)
as you can see function parameters exceed 4 bytes so it can not
be reentrant.


RSC4X has too small RAM to afford reentrancy in manner as PC.
Just develop your code in that manner that reentrancy is not
necessary.

Post Reply

Return to “RSC-4x mikroC General”