"); //-->
Q. I get the error: function * appears in multiple call graphs: rooted at *
What does this mean?
A. It means that there is a function which is being called from an interrupt
and from main code and reentrancy is not supported by the compiler.
Because the function is not reentrant, it leaves open the possibility
of it being called from both locations at the same time. There are several
possible ways to work around this:
1. If the compiler supports the "reentrant" qualifer, then define the function
with this.
2. ROM space permitting, make two copies of the function but give them different
names. One is only called by the interrupt, the other only by main code.
3. Rewrite the function such that it doesn't have any local variables or
parameters. If the function doesn't have these, then it can be called from
the interrupt and main code at the same time.
4. If you can guarantee that the function will not be called simultaneously, then
you can use the #pragma interrupt_level directive. This is detailed in the
user manuals, but in brief it is used like the following:
#pragma interrupt_level 1
void common_func(void)
{
/* local variable definitions */
/* code */
}
#pragma interrupt_level 1
void interrupt isr(void)
{
common_func();
/* more code */
}
void main(void)
{
common_func(); /* gets called before interrupts are turned on */
EI(); /* enable interrupts */
/* more code */
}
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。