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