Greetings: I'm desperately chasing obscure bugs in somebody else's code. I say this before I state that some of the ISR's are embarrassingly long, and have multiple calls to utility functions. In a knowledge base article (http://www.keil.com/support/docs/2910.htm), there is a warning that "it would be impossible to call other functions within the interrupt service routines". Since the code under scrutiny routinely does exactly this, how bad is it? It seems to me the compiler only saves registers used within the __isr routine, therefore any functions called from there may overwrite registers which may or may not be pushed and popped by the IRS itself. Is this correct, or do I worry to much (I'm getting desperate for a solution here...).
Thanks, Doug
From the knowledgebase article:
Yes, it is required to switch the CPU into the User/System Mode. Otherwise it would be impossible to call other functions within the interrupt service routine.
To be honest, I cannot see why it would be impossible to call other functions. They should work just fine. Maybe someone else in this forum can explain. If one of those functions happens to be non-reentrant you can run into obscure bugs. As usual, if there are variables shared between ISRs and normal code, special care must be taken when accessing them in normal code.
Regards, - mike