|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
Information in this article applies to:
I'm using code banking with the BL51 code banking linker and I need to find the current code bank. How can I find this out?
You must add the following function to the end of the L51_BANK.A51 configuration file.
PUBLIC get_bank get_bank: MOV A, ?B_CURRENTBANK ANL A, #?B_MASK REPT ?B_FIRSTBIT RR A ENDM MOV R7, A RET
This function returns the current code bank. To access it in C, add a function prototype as follows:
extern unsigned char get_bank (void);
and use this function in your program as follows:
printf ("We're in code bank %u ", (unsigned) get_bank ());
Article last edited on: 2008-04-06 19:43:38
Did you find this article helpful? Yes No
How can we improve this article?