This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Code Optimization

Hi

In my project i use the library rts2800_ml.lib. The Linker links all (?) functions in the library to the out-file. But many of these functions i don't need (e.g. fopen).

Is it possible to tell the linker to not link these functions? I need more space in my flash memory.

CCS 3.1.30, Code Gen. Tools 4.1.4, DSP F2812

Phil

 

  • Open Build Options... for a given project, tab Compiler, section Basic and you'll see Opt Level and Program Opt Level dropdowns. There you can set optimization levels. Don't remember now which level, but some removes unused library code.

  • I tried all optimization levels (-o0 to -o3), but the unused functions are still linked.
    The -o3 level gives me the best optimization.

    If i use any Program Level Optimization (-pm, -op0 to -op3) with the -o3 level, my code does not work any longer.

    I can not debug, because there is no space for debug information...

     

  • By default, the linker should be removing unused functions from the runtime library. I think with v4.1.4, if a function inside one of the runtime source files is referenced and pulled into the link, then the entire file will be linked in (other functions within that file will also be linked in). With the latest compiler versions, I believe the runtime library is built such that each function is within its own sub-section so only the referenced functions will be linked in. Is it possible that fopen is being called from another runtime function even though you are not calling it directly?

     

  • You could use -mo option.

    -mo option eliminates all the unused functions.

    -Krishna