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

REMOVING UNUSED CODE SEGMENTS


Hello,

I am using a third part library and from map file I notice that I include some code of unused functions in my applycation.

Do you know how I can remove these functions?
And their associated data?

Thanks in advance
Alberto.

Parents
  • Though this can be safely done, the compiler does not remove these segments. So it is the responsiblity of the library writer to place one function per file to achieve this goal. If you can not get your library writer to do this, then try the following to minimize data loss.

    char unusedFns( void )
    {
    code char unusedFnsArray[] =
    {
    unusedFn1,
    unusedFn2,
    unusedFn3
    };

    return unusedFnsArray[0];
    }

    void mainProgram( void )
    {
    //the code that used to be in main
    }

    void main() //make no changes to this function
    {
    unusedFns();
    mainProgram();
    }

Reply
  • Though this can be safely done, the compiler does not remove these segments. So it is the responsiblity of the library writer to place one function per file to achieve this goal. If you can not get your library writer to do this, then try the following to minimize data loss.

    char unusedFns( void )
    {
    code char unusedFnsArray[] =
    {
    unusedFn1,
    unusedFn2,
    unusedFn3
    };

    return unusedFnsArray[0];
    }

    void mainProgram( void )
    {
    //the code that used to be in main
    }

    void main() //make no changes to this function
    {
    unusedFns();
    mainProgram();
    }

Children
No data