Skip to content

Commit

Permalink
tests: Clean up no-std-rt
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Sep 15, 2024
1 parent c0df26d commit 4e7537f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
16 changes: 16 additions & 0 deletions tests/no-std-rt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ publish = false
qemu-system = []
qemu-user = []

# cfg(target_feature = "mclass") is not available on stable/beta.
[target.thumbv6m-none-eabi.dependencies]
cortex-m-rt = "0.7"
[target.thumbv7m-none-eabi.dependencies]
cortex-m-rt = "0.7"
[target.thumbv7em-none-eabi.dependencies]
cortex-m-rt = "0.7"
[target.thumbv7em-none-eabihf.dependencies]
cortex-m-rt = "0.7"
[target.'thumbv8m.base-none-eabi'.dependencies]
cortex-m-rt = "0.7"
[target.'thumbv8m.main-none-eabi'.dependencies]
cortex-m-rt = "0.7"
[target.'thumbv8m.main-none-eabihf'.dependencies]
cortex-m-rt = "0.7"

[workspace]
resolver = "2"

Expand Down
11 changes: 10 additions & 1 deletion tests/no-std-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ pub static BOOT_CORE_ID: u64 = 0;
#[cfg(all(target_arch = "aarch64", feature = "qemu-system"))]
core::arch::global_asm!(include_str!("../raspi/boot.s"));

#[cfg(mclass)]
pub use cortex_m_rt::{entry as cortex_m_rt_entry, *};
#[cfg(mclass)]
#[macro_export]
macro_rules! entry {
($entry_fn:ident) => {
#[::cortex_m_rt::entry]
extern crate semihosting_no_std_test_rt as cortex_m_rt;
#[::semihosting_no_std_test_rt::cortex_m_rt_entry]
fn main() -> ! {
::semihosting::process::Termination::report($entry_fn()).exit_process()
}
Expand All @@ -33,6 +36,9 @@ macro_rules! entry {
($entry_fn:ident) => {
#[no_mangle]
unsafe fn _start_rust() -> ! {
main()
}
fn main() -> ! {
::semihosting::process::Termination::report($entry_fn()).exit_process()
}
};
Expand All @@ -45,6 +51,9 @@ macro_rules! entry {
#[no_mangle]
unsafe fn _start() -> ! {
unsafe { $crate::init_start() }
main()
}
fn main() -> ! {
::semihosting::process::Termination::report($entry_fn()).exit_process()
}
};
Expand Down
16 changes: 0 additions & 16 deletions tests/no-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,6 @@ semihosting-no-std-test-rt = { path = "../no-std-rt" }
linked_list_allocator = { version = "0.10", optional = true, default-features = false }
spin = { version = "0.9", optional = true, default-features = false, features = ["spin_mutex"] }

# cfg(target_feature = "mclass") is not available on stable/beta.
[target.thumbv6m-none-eabi.dependencies]
cortex-m-rt = "0.7"
[target.thumbv7m-none-eabi.dependencies]
cortex-m-rt = "0.7"
[target.thumbv7em-none-eabi.dependencies]
cortex-m-rt = "0.7"
[target.thumbv7em-none-eabihf.dependencies]
cortex-m-rt = "0.7"
[target.'thumbv8m.base-none-eabi'.dependencies]
cortex-m-rt = "0.7"
[target.'thumbv8m.main-none-eabi'.dependencies]
cortex-m-rt = "0.7"
[target.'thumbv8m.main-none-eabihf'.dependencies]
cortex-m-rt = "0.7"

[workspace]
resolver = "2"

Expand Down

0 comments on commit 4e7537f

Please sign in to comment.