Has anyone allready implemented the bankswitching technichue described
I'm currently adding a feature to the aslink to support that.
The codesegments are configured at compile time with:
The linker finds(now it's a 3 pass linker) lcalls from one bank to
another and generates proxy function in the common area bank. The
crossbank lcalls are then painted to the proxy.
Proxy then switheches the bank, calls the original function and restores the bank.
So there is no need to declare a banked call in source/header files.
an example proxy from CC2430 MCU looks like this( but could be modified for other hardware )
If we have void led() in BANK2;
the proxy looks like:
push _FMAP ;save current bank
mov _FMAP, #0x02 ; select bank 2
lcall _led ;call _led in bank 2
pop _FMAP ;restore bank
FMAP is the bank selecting SFR on CC2430
the modifications are made in lkmain.c(making a 3 pass link) and lkrloc.c(generating proxys and relocation lcall calls)