GNU Arm Embedded Toolchain | arm-none-eabi-gcc options: What is a difference between Thumb (-mthumb) and Arm (-marm) state?

I have a maybe trivial question, but what is a difference between Thumb (-mthumb) and Arm (-marm) state and why most of the tutorials recommend to use Thumb state?

I am curious what exactly does it mean? What it is related to?

Best!

Upvotes: 1

Views: 742

Answers (1)

Frant
Frant

Reputation: 5895

I would suggest to read those two articles, one from Arm, Instruction Set Architecture (-marm means that GCC will generate arm32/A32 code, -mthumb means that it will generate thumb/T32 one), and this research paper, Profile Guided Selection of ARM and ThumbInstructions.

Basically, the two instruction sets differ in the set of instructions available as well as their encoding. You should therefore get a smaller and faster executable by using thumb/T32 than by using arm/A32.

This is the reason why most of the tutorials recommend to use the thumb/T32 instruction set.

Upvotes: 3

Related Questions