Hello, I would like to get more specific information regarding the use of #pragma REGISTERBANK(x) and AREGS/NOAREGS directivs. Assuming the following code:
void UartIsr(void) INTERRUPT(4) USING(2) { f1(); } #pragma REGISTERBANK(2) // (mark #0) void f1(void) { … … f2(); … … } #pragma REGISTERBANK(0) // (mark #1) ... ... ... #pragma REGISTERBANK(2) // (mark #2) void f2(void) { … f3(); … … } #pragma REGISTERBANK(0) // (mark #3) ... ... ... #pragma REGISTERBANK(2) // (mark #4) void f3(void) { … … … } #pragma REGISTERBANK(0) // (mark #5) ... ... ...
#pragma NOAREGS // (mark #6) void f3(void) { … … … } #pragma AREGS // (mark #7)
library function like sizeof, or printf, ... it is called from diffrent loactions in the code using diffrent register banks. You can forget about the questions you ask until you get clear in your head the calling such functions (or other lenghty stuff) in an ISR will lead to disaster. The "automatic" compiler functions (address finders, switch porocessor and such) are bank independent. They must be since you "do not know" they are used. Erik