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

Hi, Does one need to leave some free space in the Common Area and the Code banks when code banking is implemented. Also i would like to know if XDATA variables are automatically assigned to the Common Area.

  • The 8051 is a Harvard architecture, with separate code and data address spaces. No xdata variables ever occupy code address space.

    (It's fairly common to share the same physical memory for code and data, and even map the code address range into the data space so that you can write it, for a "von Neumann" architecture. Nevertheless, logically the two address spaces are separate. There are different instructions for accessing each address space (MOVX and MOVC), and code space is not writable.)

    Constants such as string literals will automatically be placed in the common bank. They can be moved to another bank if you're sure that code only in that bank will access the constants.

    Note that it is less efficient both in time and space for code to live in a bank. You want as much code in common as you can.

    However, I do think it's a good idea to keep some free space in all the banks of code. During development, you usually want to throw in a bit of debug code (some extra asserts, logging, profiling, good old printf()s) which take up extra code space, or perhaps change optimization levels. If you completely pack the common bank, you have to to reshuffle modules every time you change the code, so it's better to leave at least a little room.

  • i do misss messages from Reinhard keil,

  • Thank You very much ,Drew. I really appreciate your help.

    Note: Kindly ignore the message
    "i do misss messages from Reinhard keil,",
    as I have not posted it. I am surprised to find that it's in my name.

  • "... I have not posted it. I am surprised to find that it's in my name."

    Yes, the lack of attention to detail does kind of give impersonation away, doesn't it?

    Capitalization, spelling, punctuation, grammar -- all important components of being a truly good impostor. He/she/it really does come up short and is quite easy to spot.