How do I tell gcc to compile into Thumb1-only instructions?
Everyone knows helloworld.c:
#include <stdio.h>
main() {
printf("Hello world");
}
And this is my command line:
user@debian-armel:~$gcc -mcpu=cortex-m3 -mthumb helloworld.c && objdump -d a.out
And voilá: most instructions are 32bit wide, as opposed to the 16bit I expected.
So, what am I doing wrong?
Cortex-M3 supports Thumb-2 so the compiler is free to generate 32-bit versions. One of the following should achieve what you need:
-march=ARMv5 -mthumb
-march=ARMv4T -mthumb
-march=ARMv6-M
-mcpu=Cortex-M0