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

I am using a uVision2 and C51 compiler. I want to use code banking as my code exceeds 64K limit. how do I specify which part of the code will be in which bank(means which files to assign what bank) and which will go into the common area.

Suppose I have assigned two files of the code to be in bank0. How will I know the size occupied by the files in that bank?

Does the linker take care of the function calls if we specify some files in one bank and some files in another bank randomly?

Parents
  • What if we do not specify any common area i.e i want to use two 64K banks 0000h to ffffh.

    Then you're asking for trouble.

    A common area is necessary because the operation (switch to bank X and jump to address X) is not atomic. After executing (switch to bank X), the next command is already read from bank X.

Reply
  • What if we do not specify any common area i.e i want to use two 64K banks 0000h to ffffh.

    Then you're asking for trouble.

    A common area is necessary because the operation (switch to bank X and jump to address X) is not atomic. After executing (switch to bank X), the next command is already read from bank X.

Children
  • The dual 64KB bank scheme is also supported by Keil tools. The disadvantage is that you have to locate all common code in each bank, so that it is always present when needed. All the common routines, interrupt handlers, and so on will exist twice and take up twice as much room.

    The choice between the two is up to your address decoding hardware. Either way, you need a register with high-order bits of the code address. The address decoder either makes these bits N:16, concatenating with bits 15:0 from the CPU, to produce 64KB banks. Or, the address decoder checks bit 15 from the CPU, and replaces bits N:15 with the high-order register to produce 32KB banks.

    Given the hardware, you have to produce an L51_BANK.A51 that updates your banking hardware correctly. Some of the most common hardware designs are built in as options; you can also code completely custom routines.

    The Keil manuals and app notes are a place to start.
    http://www.keil.com/c51/codebanking.asp