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

why after deleting some functions, the IData Space overflow!

I got a demo sources from our chip vendor.
It can be compiled successfully!
However, after I comment out some functions, the compiler says that IData Space overflow. When I check the MAP file, I find that there is no ?STACK. Why?

I donot add any new file to the project, nor drop any file from the project. I only comment out several function calls in a file.

Why? Thanks a lot!

Parents
  • Hi, Davis,

    I got it. After using OVERLAY, now can work. Thanks!

    However, After I really delete the function implementations and also those OVERLAY directives, I got space overflow again! Since the implementations are deleted, and the variable are no longer exist, why I get this error again?

    Thanks!

Reply
  • Hi, Davis,

    I got it. After using OVERLAY, now can work. Thanks!

    However, After I really delete the function implementations and also those OVERLAY directives, I got space overflow again! Since the implementations are deleted, and the variable are no longer exist, why I get this error again?

    Thanks!

Children
  • the only safe way to drop functions without possible overlay problems is:

    #ifdef USE_FOO
    foo();
    #endif

    and
    #ifdef USE_FOO
    foo()
    {
    ...
    }
    #endif

    Erik

  • Hi, Erik
    thanks! But can you tell me why this method can work?

    Suppose I donot define USE_FOO, then the call to function and the function implementation are not included, which is the same as that I delete the call to function and the function implementations.

  • However, After I really delete the function implementations and also those OVERLAY directives, I got space overflow again!

    Well, it has been said here before, but let me say it again, a bit louder: You absolutely have to look at the map file to solve this kind of issue. And you have to watch out for warnings about uncalled functions --- they're serious.

    In the case at hand, odds are your now deleted function called *other* functions, which are now unused, too, and should thus be removed or commented out.

  • thanks! But can you tell me why this method can work?

    Suppose I donot define USE_FOO, then the call to function and the function implementation are not included, which is the same as that I delete the call to function and the function implementations.


    Because the linker assign space outside the call stack to functions that are not called. Thus a function called from main() only will typically not use any space for its variables (other functions have reserved the space) whareas, if it is not called the space for the variables will be added at the end of the call stack.

    Erik