You copied the Doc URL to your clipboard.

Arm Compiler armclang Reference Guide : -mthumb

-mthumb

Requests that the compiler targets the T32 instruction set.

Most Arm®v7‑A (and earlier) processors support two instruction sets. These are the A32 instruction set (formerly ARM), and the T32 instruction set (formerly Thumb). Armv8‑A processors in AArch32 state continue to support these two instruction sets, but with additional instructions. The Armv8‑A architecture additionally introduces the A64 instruction set, used in AArch64 state.

Different architectures support different instruction sets:

  • Armv8‑A processors in AArch64 state execute A64 instructions.
  • Armv8‑A processors in AArch32 state, in addition to Armv7 and earlier A- and R- profile processors execute A32 and T32 instructions.
  • M-profile processors execute T32 instructions.

Note

  • The -mthumb option is not valid for targets in AArch64 state, for example --target=aarch64-arm-none-eabi. The compiler ignores the -mthumb option and generates a warning when compiling for a target in AArch64 state.
  • The -mthumb option is recognized when using armclang as a compiler, but not when using it as an assembler. To request armclang to assemble using the T32 instruction set for your assembly source files, you must use the .thumb or .code 16 directive in the assembly files.

Default

The default for all targets that support A32 instructions is -marm.

Example

armclang -c --target=arm-arm-none-eabi -march=armv8-a -mthumb test.c
Was this page helpful? Yes No