]> git.lizzy.rs Git - rust.git/blob - src/librustc_target/spec/thumbv7em_none_eabihf.rs
bb1a42f0e289ec89109daa2f71c804059f660824
[rust.git] / src / librustc_target / spec / thumbv7em_none_eabihf.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Targets the Cortex-M4F and Cortex-M7F processors (ARMv7E-M)
12 //
13 // This target assumes that the device does have a FPU (Floating Point Unit) and lowers all (single
14 // precision) floating point operations to hardware instructions.
15 //
16 // Additionally, this target uses the "hard" floating convention (ABI) where floating point values
17 // are passed to/from subroutines via FPU registers (S0, S1, D0, D1, etc.).
18 //
19 // To opt into double precision hardware support, use the `-C target-feature=-fp-only-sp` flag.
20
21 use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
22
23 pub fn target() -> TargetResult {
24     Ok(Target {
25         llvm_target: "thumbv7em-none-eabihf".to_string(),
26         target_endian: "little".to_string(),
27         target_pointer_width: "32".to_string(),
28         target_c_int_width: "32".to_string(),
29         data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
30         arch: "arm".to_string(),
31         target_os: "none".to_string(),
32         target_env: String::new(),
33         target_vendor: String::new(),
34         linker_flavor: LinkerFlavor::Gcc,
35
36         options: TargetOptions {
37             // `+vfp4` is the lowest common denominator between the Cortex-M4 (vfp4-16) and the
38             // Cortex-M7 (vfp5)
39             // `+d16` both the Cortex-M4 and the Cortex-M7 only have 16 double-precision registers
40             // available
41             // `+fp-only-sp` The Cortex-M4 only supports single precision floating point operations
42             // whereas in the Cortex-M7 double precision is optional
43             //
44             // Reference:
45             // ARMv7-M Architecture Reference Manual - A2.5 The optional floating-point extension
46             features: "+vfp4,+d16,+fp-only-sp".to_string(),
47             max_atomic_width: Some(32),
48             .. super::thumb_base::opts()
49         }
50     })
51 }