Skip to content

Commit 432e5f5

Browse files
Merge #263
263: Import cortex-m-semihosting and panic-semihosting into this repo r=adamgreig a=jonas-schievink Motivation: * Allows writing QEMU tests for `cortex-m`'s functionality that use semihosting to control QEMU. Previously these crates would pull in another cortex-m version, which doesn't work. Now they have a `path` dependency on the root crate. * Lets us share the outline-inline-assembly setup and `cargo-xtask` in general. * Lets us share CI and bot setup between more crates. * 2 fewer repos to triage and keep track of (I'll transfer their issues after this is merged). I also want to import cortex-m-rt, but I'll do that in a later PR. CI was updated to build-test all crates with all or most feature combinations, like it did before. Co-authored-by: Jonas Schievink <[email protected]>
2 parents f77d64a + b51178f commit 432e5f5

32 files changed

+1146
-25
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ inline-asm = []
2727
linker-plugin-lto = []
2828

2929
[workspace]
30-
members = ["xtask"]
30+
members = ["xtask", "cortex-m-semihosting", "panic-semihosting"]
3131

3232
[package.metadata.docs.rs]
3333
targets = [

asm/inline.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ pub unsafe fn __wfi() {
175175
asm!("wfi");
176176
}
177177

178+
/// Semihosting syscall.
179+
#[inline(always)]
180+
pub unsafe fn __syscall(mut nr: u32, arg: u32) -> u32 {
181+
asm!("bkpt #0xab", inout("r0") nr, in("r1") arg);
182+
nr
183+
}
184+
178185
// v7m *AND* v8m.main, but *NOT* v8m.base
179186
#[cfg(any(armv7m, armv8m_main))]
180187
pub use self::v7m::*;

asm/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ macro_rules! shims {
4646
pub unsafe extern "C" fn $name(
4747
$($arg: $argty),*
4848
) $(-> $ret)? {
49-
crate::inline::$name($($arg)*)
49+
crate::inline::$name($($arg),*)
5050
}
5151
)+
5252
};
@@ -72,9 +72,10 @@ shims! {
7272
fn __udf();
7373
fn __wfe();
7474
fn __wfi();
75+
fn __syscall(nr: u32, arg: u32) -> u32;
7576
}
7677

77-
// v7m *AND* v8m.main, but *NOT* v8m.base
78+
// v7m *AND* v8m.main, but *NOT* v8m.base
7879
#[cfg(any(armv7m, armv8m_main))]
7980
shims! {
8081
fn __basepri_max(val: u8);

bin/thumbv6m-none-eabi-lto.a

608 Bytes
Binary file not shown.

bin/thumbv6m-none-eabi.a

640 Bytes
Binary file not shown.

bin/thumbv7em-none-eabi-lto.a

640 Bytes
Binary file not shown.

bin/thumbv7em-none-eabi.a

640 Bytes
Binary file not shown.

bin/thumbv7em-none-eabihf-lto.a

652 Bytes
Binary file not shown.

bin/thumbv7em-none-eabihf.a

640 Bytes
Binary file not shown.

bin/thumbv7m-none-eabi-lto.a

632 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)