October 19th, 2012, 02:53 AM
Help with error 8: code size exceeds 64K
I am getting this error while compiling my code
Menu.c(9613): error 8: code size exceeds 64K
I am using Siemens c167cr_lm ic, and my memory config is as follows
ICODE (0H - 7FFFH),NCODE(0000H-7FFFH),
NCONST (0000H - 3FFFH),FCONST (10000H - 1FFFFH),
HCONST(10000H-2FFFFH),FCODE (30000H - 7FFFFH),
I am not attaching the data sheet since de foroum won't allow me to..
please help me...Thanks in advance
October 19th, 2012, 04:22 AM
> Menu.c(9613): error 8: code size exceeds 64K
So this is a large file with lots of lines - like over 9000 lines?
I would suggest you move some of the functions into Menu2.c
Each source file compiles to it's own code segment. You can have more than one code segment in a program, but the size of any single one is limited to 64K.
By having multiple source files, you can have larger amounts of code than by having everything in a single source file.
October 23rd, 2012, 12:38 AM
Thanks Salem. i have alrdy figured out the issue, and i am moving on with de project nw.. Actually i am adding features to an old project which was written by Adam :-), so is there anyway to increase the size from 64K to higher. which will reali save a lot of tym
October 24th, 2012, 04:41 PM
I presume from Salem's explanation that this is a architectual limitation of the processor. Check the compiler documentation for limitations.
Originally Posted by cityprince143
Since these devices are now made by Infineon not Seimens, is it possible that you are using a rather old compiler for the architecture? Even if there is an architectural limitation, it is possible that a newer compiler might handle it differently and be able to perform the necessart far addressing within a single module. The said I would not bank on it since that might only serve to encourage the kind of poor ill-advised modularisation that this code appears ot exhibit.
A single sourcefile containing >9000 lines is a bad idea in any case. Breaking it up need not take much time. I suggest that you use a tool such as Doxygen to generate call graphs so that you can partition the code for maximum cohesion and minimal coupling.
Place functions that are called from many unrealted functons into spearate modules. Functions that are called from a few related functions should have static linkage in the same module as the functions that call them. That way you can minimise the number of functions you make extern and for which you need a header file prototype.