#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    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),
    NDATA0(80000H-83FFFH),NDATA(80000H-83FFFH),
    FDATA0(84000H-A3FFFH),HDATA0(84000H-FFFFFH),FDATA(E0000H-EFFFFH),
    HDATA(F0000H-FFFFFH)

    I am not attaching the data sheet since de foroum won't allow me to..


    please help me...Thanks in advance
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,384
    Rep Power
    1871
    > 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.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Thanks Salem


    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
  6. #4
  7. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,110
    Rep Power
    1803
    Originally Posted by cityprince143
    so is there anyway to increase the size from 64K to higher. which will reali save a lot of tym
    I presume from Salem's explanation that this is a architectual limitation of the processor. Check the compiler documentation for limitations.

    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.

IMN logo majestic logo threadwatch logo seochat tools logo