Search code examples
compilationarmthumbcortex-a

ARM Thumb mode: Code Size not decreasing


Guys, I have a project which I have compiled for the ARM Cortex-A8 processor. I'm making use of GCC to do this. Currently the size of my executable is 220.1 KB. Now I modify my makefile and I add the flag -mthumb, the makefile line looks somewhat like this -

gcc -mcpu=cortex-a8 -mthumb -marm -mfloat-abi=softfp -mfpu=neon

I do this changes in all my makefiles and I build my project, but the executable I get finally still continues to be of 220.1 KB.

I made one more change to my command line, I added the -mthumb-interwork option

gcc -mcpu=cortex-a8 -mthumb -mthumb-interwork -marm -mfloat-abi=softfp -mfpu=neon

Once again I get the same sized executable 220.1 KB. Am I missing anything while doing this?

I wrote a small program, to find the smallest of two numbers and I compiled it using the following command line

gcc main.c -o main

I get a 8.5 KB executable

Next, I do a

gcc -mthumb main.c -o main

I still get a 8.5 KB executable.

Whats wrong here?

I did a cat /proc/cpuinfo to see if thumb is really supported by my processor, and I see that it is indeed supported. I get -

Processor: ARMv7 Processor rev 5 (v7l)
Features: swp half thumb fastmult vfp edsp neon vfpv3
....
....

Solution

  • I think -marm means you have an arm with no thumb, try removing -marm.