1 use crate::spec::{cvs, Cc, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
3 pub fn target() -> Target {
5 llvm_target: "msp430-none-elf".into(),
7 data_layout: "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16".into(),
10 options: TargetOptions {
11 c_int_width: "16".into(),
13 // The LLVM backend currently can't generate object files. To
14 // workaround this LLVM generates assembly files which then we feed
15 // to gcc to get object files. For this reason we have a hard
16 // dependency on this specific gcc.
17 asm_args: cvs!["-mcpu=msp430"],
18 linker: Some("msp430-elf-gcc".into()),
19 linker_flavor: LinkerFlavor::Unix(Cc::Yes),
21 // There are no atomic CAS instructions available in the MSP430
22 // instruction set, and the LLVM backend doesn't currently support
23 // compiler fences so the Atomic* API is missing on this target.
24 // When the LLVM backend gains support for compile fences uncomment
25 // the `singlethread: true` line and set `max_atomic_width` to
27 max_atomic_width: Some(0),
29 // singlethread: true,
31 // Because these devices have very little resources having an
32 // unwinder is too onerous so we default to "abort" because the
33 // "unwind" strategy is very rare.
34 panic_strategy: PanicStrategy::Abort,
36 // Similarly, one almost always never wants to use relocatable
37 // code because of the extra costs it involves.
38 relocation_model: RelocModel::Static,
40 // Right now we invoke an external assembler and this isn't
41 // compatible with multiple codegen units, and plus we probably
42 // don't want to invoke that many gcc instances.
43 default_codegen_units: Some(1),
45 // Since MSP430 doesn't meaningfully support faulting on illegal
46 // instructions, LLVM generates a call to abort() function instead
47 // of a trap instruction. Such calls are 4 bytes long, and that is
48 // too much overhead for such small target.
49 trap_unreachable: false,
51 // See the thumb_base.rs file for an explanation of this value
52 emit_debug_gdb_scripts: false,
54 eh_frame_header: false,