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.
The official answer that we received from ARM support is that currently (ARMCC v5.03 [Build 24]) there is no such option available in ARMCC compiler - They just never thought about such scenario.
Hopefully it will be added to future ARMCC versions.