This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

code banking size controlling

using c8051f120 I built a project with a code size 62 k (2 k less then limit of 64 k).

Next I made my project banked as follows: c8051f120 support 4 banks with 32 k (128 k total), bank#0 is used as common bank. I placed only one small function in separate module in Bank#1 All other project in Common (Bank#0). So the code for common bank exceeds 32 k limit for bank but compilation is successful without errors and warnings. WHY?

Next I chose another small module and placed it in Bank#2
So I Have something like this

60 k => Common
 1 k => Bank#1
 1 k => Bank#2


with the bank size 32 k But this project succesfully compiled again.

Can anybody explain Should there be warning for code size for each bank or not?

Parents Reply Children
  • Yes I get common area 60K that is impossible but compiler says that it is ok. This is just the matter of the question why does compiler say it (while allowed size for common area is 32K) and what to do for compiler to work correctly with this. (All options in compliler are set as mentioned in an130.pdf SiLab KnowledgeBase with uV2.30)

    I have only 62K for code because I am stopped to write more then 64K before solving the problem :-)

    I hope that advice to use optimization is not the advice never to use code banking :-)

  • "Yes I get common area 60K"
    How do you get that?

    " that is impossible"
    Not necessarily impossible - just very unusual

    "but compiler says that it is ok."
    The compiler knows nothing about your hardware; in particular how it will implement banking - therefore it cannot comment on whether it may be right or wrong!

    "I hope that advice to use optimization is not the advice never to use code banking"

    No - the advice is not to use code banking unless you really need to!

    Clearly, you don't need to use code banking if you can get away with optimisation.

    Yes, optimisation can bring problems with debugging - but so can code banking!

    Have you reviewed your source code yet to see if it can be improved so that it doesn't need banking?

    What compiler optimisation setting are you using?


  • "Yes I get common area 60K"
    How do you get that?

    When working with code banked project each source file must be clearly associated with a bank. So I do associate all my source files with the common area (except two extremely small). These two extremely small source files I associated with bank#1 and bank#2 correspondingly.


    The compiler knows nothing about your hardware;

    Type of the controller (c8051f120) is specified in the project options as well as code banking area (0x8000 - 0xFFFF). So I do expect the compiler to be familiar with my intentions.

    Thank you for optimization advices. Optimization really helps to avoid code banking in most cases.

    In my case the question is not how to solve my just in time problem but to be the guru in 8051. So code banking still remains my glowing dream :-)

  • it is always a kludge to get the processor to do something for which it was never designed!