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

Regarding bank switching

I am using mentor graphics 8051 based 8051EW device. I am using code banking (16 banks). After running my code i am using LX51 comman to link the lnk fie and than "OHX51" to convert the obj file to hex and than "hexbin2" to convert hex to bin. In my code i have 5 files each conatning one function and a main. c file. When i palce the main.c and all the other 5 files in common bank, the following is the size of file ifound
obj format file -> 20 KB size after converting
hex file--> 2 kb size and after coverting hex to bin
bin file--> 1 kb size.

But if i place main.c in common bank and each of the five files in five seperate banks i.e bank1, bank2 so on than following is the file size odserved

obj format file -->29kb
hex file --> 6kb
bin file --> 193 kb can anone please tell me why is there such tremendous increase in the fianl executable file from 1 kb to 193 kb even though the bank switching code tht is inserted by complier is of afew bytes. Immediate help is highly appreciated

Parents Reply Children
  • Agreed!!!!!!! [:)] i thought bank switch and file size are related that's why but still why size of bin file increase so dratically is still a mystery for me

  • Probably, in the non-banked case, all the code lies in a single contiguous address range at the start of the PROM - so the the bin file contains only that address range.

    With the Banked application, you probably have a small amount of code at the start of Bank 0, then the rest of Bank 0 is blank, then a small amount of code at the start of Bank 1, then the rest of Bank 1 is blank, then a small amount of code at the start of Bank 2, then the rest of Bank 2 is blank, etc, etc,...

    The binary files has to include all these blank areas up to and including the last byte used in the last Bank.

    You should be able to see this clearly if you look at the contents of the bin files using a suitable binary file viewer.

    eg, www.catch22.net/.../hexedit

  • hey Andy thanks for help..........your post was of great help to me..[:)]