2022-08-06 18:08:46 +00:00
|
|
|
use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions};
|
2020-07-26 11:58:37 +00:00
|
|
|
|
|
|
|
/// A base target for AVR devices using the GNU toolchain.
|
|
|
|
///
|
|
|
|
/// Requires GNU avr-gcc and avr-binutils on the host system.
|
2022-06-17 14:38:42 +00:00
|
|
|
/// FIXME: Remove the second parameter when const string concatenation is possible.
|
|
|
|
pub fn target(target_cpu: &'static str, mmcu: &'static str) -> Target {
|
2020-10-05 12:37:55 +00:00
|
|
|
Target {
|
2022-03-22 10:43:05 +00:00
|
|
|
arch: "avr".into(),
|
|
|
|
data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".into(),
|
|
|
|
llvm_target: "avr-unknown-unknown".into(),
|
2020-10-14 16:08:12 +00:00
|
|
|
pointer_width: 16,
|
2020-07-26 11:58:37 +00:00
|
|
|
options: TargetOptions {
|
2022-03-22 10:43:05 +00:00
|
|
|
c_int_width: "16".into(),
|
|
|
|
cpu: target_cpu.into(),
|
|
|
|
exe_suffix: ".elf".into(),
|
2020-07-30 16:04:26 +00:00
|
|
|
|
2022-03-22 10:43:05 +00:00
|
|
|
linker: Some("avr-gcc".into()),
|
2020-07-30 16:04:26 +00:00
|
|
|
eh_frame_header: false,
|
2022-08-06 18:08:46 +00:00
|
|
|
pre_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[mmcu]),
|
|
|
|
late_link_args: TargetOptions::link_args(
|
|
|
|
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
|
|
|
|
&["-lgcc"],
|
|
|
|
),
|
2020-09-05 09:33:01 +00:00
|
|
|
max_atomic_width: Some(0),
|
|
|
|
atomic_cas: false,
|
2022-06-28 09:40:39 +00:00
|
|
|
relocation_model: RelocModel::Static,
|
2020-07-30 16:04:26 +00:00
|
|
|
..TargetOptions::default()
|
2020-07-26 11:58:37 +00:00
|
|
|
},
|
2020-10-05 12:37:55 +00:00
|
|
|
}
|
2020-07-26 11:58:37 +00:00
|
|
|
}
|