1 use crate::spec
::{LinkerFlavor, PanicStrategy, 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()),
25 no_integrated_as
: true,
27 // There are no atomic CAS instructions available in the MSP430
28 // instruction set, and the LLVM backend doesn't currently support
29 // compiler fences so the Atomic* API is missing on this target.
30 // When the LLVM backend gains support for compile fences uncomment
31 // the `singlethread: true` line and set `max_atomic_width` to
33 max_atomic_width
: Some(0),
35 // singlethread: true,
37 // Because these devices have very little resources having an
38 // unwinder is too onerous so we default to "abort" because the
39 // "unwind" strategy is very rare.
40 panic_strategy
: PanicStrategy
::Abort
,
42 // Similarly, one almost always never wants to use relocatable
43 // code because of the extra costs it involves.
44 relocation_model
: "static".to_string(),
46 // Right now we invoke an external assembler and this isn't
47 // compatible with multiple codegen units, and plus we probably
48 // don't want to invoke that many gcc instances.
49 default_codegen_units
: Some(1),
51 // Since MSP430 doesn't meaningfully support faulting on illegal
52 // instructions, LLVM generates a call to abort() function instead
53 // of a trap instruction. Such calls are 4 bytes long, and that is
54 // too much overhead for such small target.
55 trap_unreachable
: false,
57 // See the thumb_base.rs file for an explanation of this value
58 emit_debug_gdb_scripts
: false,
60 .. Default
::default( )