I'm trying to remove unused code with Keil ARM tools that use ARMCC compiler. I've previously used GCC based compilers for ARM and I could easily remove the unused code with:
-fdata-sections -ffunction-sections
For ARMCC i found similar flag
--split_sections
but it works only with functions and not with variables.
Is there any way to remove unused variables with ARMCC?
Edit:
For example giving the following library code:
lib.c :
static int veryBigArray[1000000UL];
int func1() { ... }
int func2() { memset(veryBigArray, 0, sizeof(veryBigArray); }
and my project code:
project.c:
int main(void)
{
func1();
}
I want to remove func2() and veryBigArray using compiler/linker optimizations.