1 use crate::spec::{cvs, Target, TargetOptions};
2 use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel};
4 pub fn target() -> Target {
6 data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
7 llvm_target: "riscv32".into(),
9 arch: "riscv32".into(),
11 options: TargetOptions {
12 families: cvs!["unix"],
15 vendor: "espressif".into(),
16 linker_flavor: LinkerFlavor::Gcc,
17 linker: Some("riscv32-esp-elf-gcc".into()),
18 cpu: "generic-rv32".into(),
20 // While the RiscV32IMC architecture does not natively support atomics, ESP-IDF does support
21 // the __atomic* and __sync* GCC builtins, so setting `max_atomic_width` to `Some(64)`
22 // and `atomic_cas` to `true` will cause the compiler to emit libcalls to these builtins.
24 // Support for atomics is necessary for the Rust STD library, which is supported by the ESP-IDF framework.
25 max_atomic_width: Some(64),
28 features: "+m,+c".into(),
29 panic_strategy: PanicStrategy::Abort,
30 relocation_model: RelocModel::Static,
31 emit_debug_gdb_scripts: false,
32 eh_frame_header: false,