Skip to content

Commit f71a627

Browse files
committed
migrate thumb-none-cortex-m to rmake
1 parent a886938 commit f71a627

File tree

3 files changed

+58
-39
lines changed

3 files changed

+58
-39
lines changed

Diff for: src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ run-make/stable-symbol-names/Makefile
5050
run-make/staticlib-dylib-linkage/Makefile
5151
run-make/symbol-mangling-hashed/Makefile
5252
run-make/sysroot-crates-are-unstable/Makefile
53-
run-make/thumb-none-cortex-m/Makefile
5453
run-make/thumb-none-qemu/Makefile
5554
run-make/translation/Makefile
5655
run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile

Diff for: tests/run-make/thumb-none-cortex-m/Makefile

-38
This file was deleted.

Diff for: tests/run-make/thumb-none-cortex-m/rmake.rs

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//! How to run this
2+
//! $ ./x.py clean
3+
//! $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi tests/run-make
4+
//!
5+
//! Supported targets:
6+
//! - thumbv6m-none-eabi (Bare Cortex-M0, M0+, M1)
7+
//! - thumbv7em-none-eabi (Bare Cortex-M4, M7)
8+
//! - thumbv7em-none-eabihf (Bare Cortex-M4F, M7F, FPU, hardfloat)
9+
//! - thumbv7m-none-eabi (Bare Cortex-M3)
10+
11+
//@ only-thumb
12+
13+
use std::path::PathBuf;
14+
15+
use run_make_support::rfs::create_dir;
16+
use run_make_support::{cmd, env_var};
17+
18+
const CRATE: &str = "cortex-m";
19+
const CRATE_URL: &str = "https://github.com/rust-embedded/cortex-m";
20+
const CRATE_SHA1: &str = "a448e9156e2cb1e556e5441fd65426952ef4b927"; // v0.5.0
21+
22+
fn main() {
23+
// See below link for git usage:
24+
// https://stackoverflow.com/questions/3489173#14091182
25+
cmd("git").args(["clone", CRATE_URL, CRATE]).run();
26+
std::env::set_current_dir(CRATE).unwrap();
27+
cmd("git").args(["reset", "--hard", CRATE_SHA1]).run();
28+
29+
let target_dir = PathBuf::from("target");
30+
let target = env_var("TARGET");
31+
32+
let manifest_path = PathBuf::from("Cargo.toml");
33+
34+
let path = env_var("PATH");
35+
let rustc = env_var("RUSTC");
36+
let bootstrap_cargo = env_var("BOOTSTRAP_CARGO");
37+
let mut cmd = cmd(bootstrap_cargo);
38+
cmd.args(&[
39+
"build",
40+
"--manifest-path",
41+
manifest_path.to_str().unwrap(),
42+
"-Zbuild-std=core",
43+
"--target",
44+
&target,
45+
])
46+
.env("PATH", path)
47+
.env("RUSTC", rustc)
48+
// Don't make lints fatal, but they need to at least warn
49+
// or they break Cargo's target info parsing.
50+
.env("RUSTFLAGS", "-Copt-level=0 -Cdebug-assertions=yes --cap-lints=warn")
51+
.env("CARGO_TARGET_DIR", &target_dir)
52+
.env("RUSTC_BOOTSTRAP", "1")
53+
// Visual Studio 2022 requires that the LIB env var be set so it can
54+
// find the Windows SDK.
55+
.env("LIB", std::env::var("LIB").unwrap_or_default());
56+
57+
cmd.run();
58+
}

0 commit comments

Comments
 (0)