Page 1 of 1

Code Banking

PostPosted: Thu Apr 22, 2004 6:16 am
We have application with Salvo Pro 8051 v.3.2 with Keil Tools : C51 and BL51,
Large model memory,C8051F124. Does Salvo support the code banking and switching code banking ?
In User Manual only is mentioned about
RAM banks , not ROM banks. Is the problem
to use Salvo with code banking ?

Re: Code Banking

PostPosted: Fri Apr 23, 2004 2:14 am
by aek
The Salvo Cx51 Reference Manual has been updated ...


Re: Code Banking

PostPosted: Fri Apr 23, 2004 9:51 am
by aek

The simplest way to use Salvo in a banked application is to keep all of the Salvo code AND the Salvo tasks in the common area. This will probably also yield the best performance.

This way, the only effect of bank selection on Salvo code is when a banked user function is called from within a Salvo task, e.g.

void Task (void)
for ( ; ; )

where Cx51/BL51 handles the call to myBankedFn() as a banked call. So, you could put all of your user functions in banked ROM, with just Salvo and the Salvo tasks in common ROM.

This is the simplest way, but you may not want to keep all of Salvo and your Salvo tasks in the common area.

The only place I can think of where the Salvo code may have problems with banking is in OSSched(), because tasks are dispatched via an indirect function call, and the stack is affected. Either of these may cause problems with L51_bank.a51. I think (though I have not tested it) that you could do a source-code build with banking where Salvo's sched.c and all of your Salvo tasks are in the common area, but the rest of the Salvo code (e.g. qins.c, delay.c, etc.) is located in a ROM bank. By placing sched.c and the tasks in the common area, there's no banking involved in the critical and complex issue of task dispatching.

I don't think that sched.c and the Salvo tasks van be placed in banked ROM, because l51_bank.a51 affects the stack, and it will probably break the Salvo context switcher. But I'm not sure of this ...


Configuration 1 ***

Common ROM: Salvo source + Salvo tasks
Banked ROM: User functions

will work.

Configuration 2 ***

Common ROM: salvosrcsched.c + Salvo tasks
Banked ROM: rest of Salvo + User functions

should work. 2 will be much slower than 1 because of all the banking that will occur when Salvo's banked internal functions are called.

Configuration 3 ***

Common ROM: user
Banked ROM: Salvo source + Salvo tasks


Common ROM: user + Salvo tasks
Banked ROM: Salvo source

probably won't work because the call-by-pointer in OSSched (sched.c) will probably be broken by l51_bank.a51.

Please let us know what you end up with ...


[This message has been edited by aek (edited April 23, 2004).]

Re: Code Banking

PostPosted: Sat Apr 24, 2004 10:27 am
Hello aek !
Thanks for your very good and
timely answer and advice !