I have following question about code banking. There's some small tests, that uses one big library. So, how can I put this library to different code banks? Ofc, I can include this tests right in library project, but are there any other solutions?
For example, create 3 libraries for 3 differents banks, just like .h00, .h01 etc. But I don't know is it possible in keil
Your question is based on rather complete misunderstanding of what a library is for. There's nothing to be gained from forcing its code into a particular bank.
"There's nothing to be gained from forcing its code into a particular bank."
Surely that depends upon the intra-bank call overhead and the hardware logic used for bank selection?
Calling a (library) function contained within the same bank does not require that overhead and could therefore have a significant speed advantage.
Only in just how bad, exactly, the effect is.
Which is exactly why it's a bad idea to fight the linker over where the best place for each object module is.
Indeed - and code banking is always a fight against the fundamental limitations of the architecture.
The fight might have been worth it years ago when there was little alternative - but, nowadays, why not just use an architecture which doesn't impose these restrictions in the first place??!
"Which is exactly why it's a bad idea to fight the linker over where the best place for each object module is."
Assuming that the linker knows the precise details of every relevant detail of the hardware configuration.
The linker makes decisions based upon information it has available to it and the rules it has been programmed to use. If detail is missing, then the result may not be the optimum.
Sometimes, little hints about placement can help - Especially with an architecture like the '51.
As always, the key is understanding of the hardware and tools.
"There's nothing to be gained from forcing its code into a particular bank." Well, I have a library > 64k. And so?
"...why not just use an architecture which doesn't impose these restrictions in the first place??!"
In an ideal world, that has surely got to be the best solution.
But ... Out of interest, have you never been presented with a piece of hardware and given the one instruction of "make it work"?
What you're being told is that you don't need to explicitly specify which bank the code goes into. The linker will fit the code into the banks which you say are available.
That should work.
When you get a deeper understanding of the banking mechanism and linker controls, you could (if you feel it is necessary) start locating certain blocks of code into specific banks - But if the code runs at an acceptable speed, then you do not have to.
"The linker makes decisions based upon information it has available to it and the rules it has been programmed to use. If detail is missing, then the result may not be the optimum." Agreed, linker only follows presets from l51_bank.a51. So, some tweaks seems reasonable.
"What you're being told is that you don't need to explicitly specify which bank the code goes into. The linker will fit the code into the banks which you say are available." Sure? But linker can't split library to different code banks. It's not a project or smth. It's only .LIB with some API. Ive solved this problem, but I dont like my solution at all. And I want another one.
Mb, I need to explain. Ive include library with code>64k in project. And I want to split it to different code bank, because its the only way to compile this project.
*code banks
What you're saying there does not make sense to me.
What type of library is this?
Normally object modules will be extracted from a library file during the link process {and would be located in a suitable bank]. Unless you have an object module that is larger than the size of one of your banks, I cannot see how there can be a problem.
Ive solved this problem
How? Did you split the library?