forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#60135 - Gilnaa:arm-none-eabi, r=nagisa
Added arm-none-eabi target Hello, This PR adds a new target for compiling bare-metal ARM Cortex-A programs. I've managed to build and use this new target, but I am unclear with regards to a few details: - I'm not sure what are the criteria for choosing between lld and gnu-ld - When trying to build with `./x.py build --target arm-none-eabi`, the script tries to compile with `cc`, instead of `arm-none-eabi-gcc`. It could find different cross-compilers just fine, but I didn't understand where I had to specify it. (I ended up specifying `CC_arm_none_eabi=arm-none-eabi-gcc` in the environment). - I couldn't find where I can exclude std from compiling for this target (as I guess occurs with other bare-metal targets). - Should I add a separate target for `eabihf`?
- Loading branch information
Showing
5 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Generic ARM-v7 Cortex-A target, with software floating-point emulation. | ||
// | ||
// Can be used in conjunction with the `target-feature` and | ||
// `target-cpu` compiler flags to opt-in more hardware-specific | ||
// features. | ||
// | ||
// For example, `-C target-cpu=cortex-a7`. | ||
|
||
use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; | ||
|
||
pub fn target() -> TargetResult { | ||
Ok(Target { | ||
llvm_target: "armv7a-none-eabi".to_string(), | ||
target_endian: "little".to_string(), | ||
target_pointer_width: "32".to_string(), | ||
target_c_int_width: "32".to_string(), | ||
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), | ||
arch: "arm".to_string(), | ||
target_os: "none".to_string(), | ||
target_env: String::new(), | ||
target_vendor: String::new(), | ||
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), | ||
|
||
options: TargetOptions { | ||
features: "+strict-align,+v7,+thumb2,-neon".to_string(), | ||
linker: Some("rust-lld".to_owned()), | ||
executables: true, | ||
relocation_model: "static".to_string(), | ||
max_atomic_width: Some(64), | ||
panic_strategy: PanicStrategy::Abort, | ||
abi_blacklist: super::arm_base::abi_blacklist(), | ||
.. Default::default() | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Generic ARM-v7 Cortex-A target, with hardware floating-point. | ||
// | ||
// Can be used in conjunction with the `target-feature` and | ||
// `target-cpu` compiler flags to opt-in more hardware-specific | ||
// features. | ||
// | ||
// For example, `-C target-cpu=cortex-a7`. | ||
|
||
use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; | ||
|
||
pub fn target() -> TargetResult { | ||
Ok(Target { | ||
llvm_target: "armv7a-none-eabihf".to_string(), | ||
target_endian: "little".to_string(), | ||
target_pointer_width: "32".to_string(), | ||
target_c_int_width: "32".to_string(), | ||
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), | ||
arch: "arm".to_string(), | ||
target_os: "none".to_string(), | ||
target_env: String::new(), | ||
target_vendor: String::new(), | ||
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), | ||
|
||
options: TargetOptions { | ||
features: "+strict-align,+v7,+vfp3,+d16,+thumb2,-neon".to_string(), | ||
linker: Some("rust-lld".to_owned()), | ||
executables: true, | ||
relocation_model: "static".to_string(), | ||
max_atomic_width: Some(64), | ||
panic_strategy: PanicStrategy::Abort, | ||
abi_blacklist: super::arm_base::abi_blacklist(), | ||
.. Default::default() | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters