The #pragma interrupt handler directive needs to be used only when the Preserve and Restore CPU context is not being done before and after calling the C function from the INT.asm file. For example, if the sequence of calling the C function from the concerned INT.asm file is as below:
Then the function My_C_Function should not be declared with a #pragma interrupt handler directive. This is because, the #pragma interrupt handler directive adds an additional Preserve and Restore, as well a return from interrupt at the end of the My_C_Function, which causes program counter corruption and the code gets into an unknown loop.
If using the #pragma interrupt handler directive , the call in the INT.asm has to be just:
Note again that it should not be a lcall, but a ljmp while using this directive.