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