Found my problem... The compiler needed to have the "#pragma interrupt called" before the very first prototype declaration. I had my first declaration in the header file as 'extern'.
I checked the code and the compiler generates RTIs and RTSs where needed.
Summary:
-----------
From vector table:
... jsr ISR_Function() // jump to ISR function ...
-----------
void ISR_Function(void){ // my ISR function
#pragma interrupt warn *** THIS ONE NEEDS TO BE HERE,
NOT BEFORE PROTOTYPE ***
SecondFunction(); // call SecondFunction
} *** COMPILER ISSUES AN RTI HERE ***
-----------
From header file: // header file of SecondFunction
#pragma interrupt called
extern void SecondFunction(void); *** FOR SOME REASON,
PRAGMA GOES BEFORE THIS
DECLARATION ***
-----------
From c file:
void SecondFunction(void); *** PRAGMA DOES NOT WORK
BEFORE THIS DECLARATION ***
void SecondFunction(void){
*** PRAGMA DOES NOT WORK INSIDE THIS FUNCTION ***
.....
} *** COMPILER ISSUES AN RTS ***
Does this make any sense? I find it a bit strange to have to use the #pragma in the declaration that has an 'extern'. Build manual does not seem to specify this. Moreover, I could never make the #pragma work inside the function body, as explained in the manual.
Thanks for all help
Mariano