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