hi,

Has anyone allready implemented the bankswitching technichue described in http://sourceforge.net/forum/message.php?msg_id=3360254

I'm currently adding a feature to the aslink to support that.
Basicaly,
The codesegments are configured at compile time with:
    --codeseg BANK2
linked with:
    -Wl-bBANK2=0x028000



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:

.globl _FMAL
.globl _led

_bc_led::
    push _FMAP ;save current bank
    mov _FMAP, #0x02 ; select bank 2
    lcall _led ;call _led in bank 2
    pop _FMAP   ;restore bank
    ret


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)

Any comments/suggestions.

Cheers,
Peter


--
http://www.pkuhar.com/