Tool/software: TI C/C++ Compiler
I am developing applications in C2000 and MSP430 and have noticed a significant difference in the way the compiler/linker works. In the MSP430 if a function is not called from main or an ISR then it is not included in the binary, as expected. However when compiling a C2000 application ALL the functions (and globals) defined in any .c files are included the final program, resulting in a huge binary.
I have tried Compiler 16.9.1, 16.9.3 and 17.3.0 with no difference. In all cases when I add a dummy function to the main .c file like:
void opt_test ( void) { int bla = 0; if (bla++) return; }
then the size of .text increases and opt_test is mentioned in the .map file. I am compiling using -O3 (I cannot use -O4 due to MotorWare limitations on F28027) and -mf 5 (optimise for size).
EDIT: I used the optimisation assisant to test various optimisation settings for -mf and all options produced the same binary size, maybe this points to the issue? Various -O settings do affect the binary size as expected though.
Best regards,
Giannis