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