-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #128636 - folkertdev:rmake-thumb-none-cortex-m, r=<try>
migrate `thumb-none-cortex-m` to rmake tracking issue: #121876 I'll leave some comments/questions inline r? `@jieyouxu` try-job: armhf-gnu try-job: dist-various-1 try-job: test-various
- Loading branch information
Showing
3 changed files
with
58 additions
and
39 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 was deleted.
Oops, something went wrong.
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,58 @@ | ||
//! How to run this | ||
//! $ ./x.py clean | ||
//! $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi tests/run-make | ||
//! | ||
//! Supported targets: | ||
//! - thumbv6m-none-eabi (Bare Cortex-M0, M0+, M1) | ||
//! - thumbv7em-none-eabi (Bare Cortex-M4, M7) | ||
//! - thumbv7em-none-eabihf (Bare Cortex-M4F, M7F, FPU, hardfloat) | ||
//! - thumbv7m-none-eabi (Bare Cortex-M3) | ||
|
||
//@ only-thumb | ||
|
||
use std::path::PathBuf; | ||
|
||
use run_make_support::rfs::create_dir; | ||
use run_make_support::{cmd, env_var}; | ||
|
||
const CRATE: &str = "cortex-m"; | ||
const CRATE_URL: &str = "https://github.com/rust-embedded/cortex-m"; | ||
const CRATE_SHA1: &str = "a448e9156e2cb1e556e5441fd65426952ef4b927"; // v0.5.0 | ||
|
||
fn main() { | ||
// See below link for git usage: | ||
// https://stackoverflow.com/questions/3489173#14091182 | ||
cmd("git").args(["clone", CRATE_URL, CRATE]).run(); | ||
std::env::set_current_dir(CRATE).unwrap(); | ||
cmd("git").args(["reset", "--hard", CRATE_SHA1]).run(); | ||
|
||
let target_dir = PathBuf::from("target"); | ||
let target = env_var("TARGET"); | ||
|
||
let manifest_path = PathBuf::from("Cargo.toml"); | ||
|
||
let path = env_var("PATH"); | ||
let rustc = env_var("RUSTC"); | ||
let bootstrap_cargo = env_var("BOOTSTRAP_CARGO"); | ||
let mut cmd = cmd(bootstrap_cargo); | ||
cmd.args(&[ | ||
"build", | ||
"--manifest-path", | ||
manifest_path.to_str().unwrap(), | ||
"-Zbuild-std=core", | ||
"--target", | ||
&target, | ||
]) | ||
.env("PATH", path) | ||
.env("RUSTC", rustc) | ||
// Don't make lints fatal, but they need to at least warn | ||
// or they break Cargo's target info parsing. | ||
.env("RUSTFLAGS", "-Copt-level=0 -Cdebug-assertions=yes --cap-lints=warn") | ||
.env("CARGO_TARGET_DIR", &target_dir) | ||
.env("RUSTC_BOOTSTRAP", "1") | ||
// Visual Studio 2022 requires that the LIB env var be set so it can | ||
// find the Windows SDK. | ||
.env("LIB", std::env::var("LIB").unwrap_or_default()); | ||
|
||
cmd.run(); | ||
} |