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
"After running my code i am using LX51 comman to link"
You can't run you code before it's linked!
I presume you mean, "After compiling my code..."?
"can anone please tell me why is there such tremendous increase in the fianl executable file"
It's not actually an "executable file"; it is just a byte-by-byte image of your PROM - including the blank spaces that are unused in each Bank!
The Hex file will also have additional overheads to deal with loading the code into the different address ranges.
Note that the "obj" format includes debug information.
ya i am srry it shud be after compiling............but the bin file that is generated is what i am loading into the hardware.......and it is runnig as per expected.....if this is not an executable file than how *** the h/w is running properly..........also let me knw hw to generate the exe file in tht case w/o much increase in the size of the file when bank switching is used, it is very important for me to know this as this would affect application design. Also i tried reading the obj file that is OMF51 format, but i couldnt figure out nything as it consist of some symbols...please let me knw frm where to get the debug information
Pls stp t abrvs - mks ur txt v hrd 2 rd
ok agreed.......but can i get the solution for my problem.please
Why do you think you actually have a problem?
The sizes of the files are (almost) totally irrelevant to your actual target hardware - they are only of use to the tools that load your software into the target.
So, provided the code loads correctly & works correctly, there is no problem!
If you want to know the actual size of the code in your PROM, then look at the message given at the end of the build in the uVision build output window; eg:
Build target 'Simulator' compiling HELLO.C... linking... Program Size: data=30.1 xdata=0 code=1096 "HELLO" - 0 Error(s), 0 Warning(s).
http://www.keil.com/support/man/docs/uv3/uv3_ca_buildproject.htm
You can get more detailed information in the Linker Listing file, or map file.
For example, if you have a 128K PROM, then the binary file to represent the contents of that PROM will be 128K - but that size tells you absolutely nothing whatsoever about how many of those bytes are actually being used by your code!
ok that means the program size in the MAP file is real indication of the total number of bytes that actually the application uses in the memory.
i want to figure out how to place files in different banks so as to optimize the memory usage of PROM, i have considered that there is minimum bank switching while writing the API, but does the format in which the file are placed in different banks affects the size of the code and also its runtime (of the 64 kbytes lower 32 kbyte is common area and upper 32 kbyte can be replaced by any of one 16 banks available)
View all questions in Keil forum