Tool/software: Code Composer Studio
Hi,
I am using Linker option --unused_section_elimination=on, but unused functions remain on the map file.
How do I remove unused function from map file? Are there any options? Are there any ways?
Thanks,
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.
Tool/software: Code Composer Studio
Hi,
I am using Linker option --unused_section_elimination=on, but unused functions remain on the map file.
How do I remove unused function from map file? Are there any options? Are there any ways?
Thanks,
You are probably not using the compiler option --gen_func_subsections. This option causes each function to be placed in a separate input section. In turn, this makes it possible for the linker to remove the section/function that is not used/called.
Thanks and regards,
-George
KH@ said:do I need to turn --unused_section_elimination and --gen_func_subsections on at the same time?
Yes. But since --unused_section_elimination is on by default, you don't need to explicitly specify it.
-George
I suspect one or more files in the library are not built --gen_func_subsections, and look like this ...
int function_that_is_called(/* args here */)
{
/* code here */
}
int function_never_called(/* args here */)
{
/* code here */
}
This object file is brought from the library into the application because your application calls function_that_is_called. The .text section in that file defines both functions. The linker cannot split up one section from one file like this .text section. So, your application ends up with both functions. If you can, rebuild the library with --gen_func_subsections.
Thanks and regards,
-George
The advantage is not losing memory space to functions that are never called. The disadvantage varies between processors. Which processor is being used? The ARM Cortex-R4F, or the DSP C674x?
Thanks and regards,
-George
Using --gen_func_subsections can, in some cases, cause code size to increase. To understand why, please see Appendix A in the application note Advanced Linker Techniques for Convenient and Efficient Memory Usage. In that app note, the term TMS470R1x means ARM. That is the old TI designation for the ARM processor family.
Thanks and regards,
-George