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.
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.
11 use {LinkerFlavor, PanicStrategy}
;
12 use target
::{Target, TargetOptions, TargetResult}
;
14 pub fn target() -> TargetResult
{
16 llvm_target
: "msp430-none-elf".to_string(),
17 target_endian
: "little".to_string(),
18 target_pointer_width
: "16".to_string(),
19 target_c_int_width
: "16".to_string(),
20 data_layout
: "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16".to_string(),
21 arch
: "msp430".to_string(),
22 target_os
: "none".to_string(),
23 target_env
: "".to_string(),
24 target_vendor
: "".to_string(),
25 linker_flavor
: LinkerFlavor
::Gcc
,
27 options
: TargetOptions
{
30 // The LLVM backend currently can't generate object files. To
31 // workaround this LLVM generates assembly files which then we feed
32 // to gcc to get object files. For this reason we have a hard
33 // dependency on this specific gcc.
34 asm_args
: vec
!["-mcpu=msp430".to_string()],
35 linker
: "msp430-elf-gcc".to_string(),
36 no_integrated_as
: true,
38 // There are no atomic instructions available in the MSP430
40 max_atomic_width
: Some(0),
42 // Because these devices have very little resources having an
43 // unwinder is too onerous so we default to "abort" because the
44 // "unwind" strategy is very rare.
45 panic_strategy
: PanicStrategy
::Abort
,
47 // Similarly, one almost always never wants to use relocatable
48 // code because of the extra costs it involves.
49 relocation_model
: "static".to_string(),
51 // Right now we invoke an external assembler and this isn't
52 // compatible with multiple codegen units, and plus we probably
53 // don't want to invoke that many gcc instances.
54 default_codegen_units
: Some(1),
56 .. Default
::default( )