Skip to content

Commit fcaba9c

Browse files
arm target docs: clarify A32/T32/Arm ISA/Thumb ISA/Thumb-2 ISA
1 parent de0c02c commit fcaba9c

File tree

1 file changed

+36
-15
lines changed

1 file changed

+36
-15
lines changed

src/doc/rustc/src/platform-support/arm-none-eabi.md

+36-15
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,43 @@ This documentation covers details that apply to a range of bare-metal targets
3434
for 32-bit Arm CPUs. In addition, target specific details may be covered in
3535
their own document.
3636

37-
If a target ends in `eabi`, that target uses the so-called *soft-float ABI*:
38-
functions which take `f32` or `f64` as arguments will have those values packed
39-
into integer registers. This means that an FPU is not required from an ABI
37+
There are two 32-bit instruction set architectures (ISAs) defined by Arm:
38+
39+
- The [*A32 ISA*][a32-isa], with fixed-width 32-bit instructions. Previously
40+
known as the *Arm* ISA, this originated with the original ARM1 of 1985 and has
41+
been updated by various revisions to the architecture specifications ever
42+
since.
43+
- The [*T32 ISA*][t32-isa], with a mix of 16-bit and 32-bit width instructions.
44+
Note that this term includes both the original 16-bit width *Thumb* ISA
45+
introduced with the Armv4T architecture in 1994, and the later 16/32-bit sized
46+
*Thumb-2* ISA introduced with the Armv6T2 architecture in 2003. Again, these
47+
ISAs have been revised by subsequent revisions to the relevant Arm
48+
architecture specifications.
49+
50+
There is also a 64-bit ISA with fixed-width 32-bit instructions called the *A64
51+
ISA*, but targets which implement that instruction set generally start with
52+
`aarch64*` and are discussed elsewhere.
53+
54+
Rust targets starting with `arm*` generate Arm (A32) code by default, whilst
55+
targets named `thumb*` generate Thumb (T32) code by default. Most Arm chips
56+
support both Thumb mode and Arm mode, with the notable exception that M-profile
57+
processors (`thumbv*m*-none-eabi*` targets) *only* support Thumb-mode.
58+
59+
Rust targets ending with `eabi` use the so-called *soft-float ABI*: functions
60+
which take `f32` or `f64` as arguments will have those values packed into
61+
integer registers. This means that an FPU is not required from an ABI
4062
perspective, but within a function floating-point instructions may still be used
4163
if the code is compiled with a `target-cpu` or `target-feature` option that
4264
enables FPU support.
4365

44-
If a target ends in `eabihf`, that target uses the so-called *hard-float ABI*:
45-
functions which take `f32` or `f64` as arguments will have them passed via FPU
46-
registers. These targets therefore require the availability of an FPU and will
47-
assume some baseline level of floating-point support is available (which can
48-
vary depending on the target). More advanced floating-point instructions may be
49-
generated if the code is compiled with a `target-cpu` or `target-feature` option
50-
that enables such additional FPU support. For example, if a given hard-float
51-
target has baseline *single-precision* (`f32`) support in hardware, there may be
66+
Rust targets ending in `eabihf` use the so-called *hard-float ABI*: functions
67+
which take `f32` or `f64` as arguments will have them passed via FPU registers.
68+
These targets therefore require the availability of an FPU and will assume some
69+
baseline level of floating-point support is available (which can vary depending
70+
on the target). More advanced floating-point instructions may be generated if
71+
the code is compiled with a `target-cpu` or `target-feature` option that enables
72+
such additional FPU support. For example, if a given hard-float target has
73+
baseline *single-precision* (`f32`) support in hardware, there may be
5274
`target-cpu` or `target-feature` options that tell LLVM to assume your processor
5375
in fact also has *double-precision* (`f64`) support.
5476

@@ -59,6 +81,9 @@ processor cannot support will be lowered to library calls (like `__aeabi_dadd`)
5981
which perform the floating-point operation in software using integer
6082
instructions.
6183

84+
[t32-isa]: https://developer.arm.com/Architectures/T32%20Instruction%20Set%20Architecture
85+
[a32-isa]: https://developer.arm.com/Architectures/A32%20Instruction%20Set%20Architecture
86+
6287
## Target CPU and Target Feature options
6388

6489
It is possible to tell Rust (or LLVM) that you have a specific model of Arm
@@ -126,10 +151,6 @@ according to the specific device you are using. Pass
126151
`-Clink-arg=-Tyour_script.ld` as a rustc argument to make the linker use
127152
`your_script.ld` during linking.
128153

129-
Targets named `thumb*` instead of `arm*` generate Thumb (T32) code by default
130-
instead of Arm (A32) code. Most Arm chips support both Thumb mode and Arm mode,
131-
except that M-profile processors (`thumbv*m*-*` targets) only support Thumb-mode.
132-
133154
For the `arm*` targets, Thumb-mode code generation can be enabled by using `-C
134155
target-feature=+thumb-mode`. Using the unstable
135156
`#![feature(arm_target_feature)]`, the attribute `#[target_feature(enable =

0 commit comments

Comments
 (0)