diff options
author | 2022-02-25 01:57:16 +0000 | |
---|---|---|
committer | 2022-02-25 01:58:23 +0000 | |
commit | ac2a8365721b453f005feb7fe1fb25615f76af7c (patch) | |
tree | bc59ffdd19ed3aa6e9b3738bfbedc954f4ecda9c /cortex-m-semihosting/src/lib.rs | |
parent | b49bcbe9fd6bbc36874a6d763c07b97aca8df71f (diff) | |
download | cortex-m-ac2a8365721b453f005feb7fe1fb25615f76af7c.tar.gz cortex-m-ac2a8365721b453f005feb7fe1fb25615f76af7c.tar.zst cortex-m-ac2a8365721b453f005feb7fe1fb25615f76af7c.zip |
Put inline asm directly into cortex-m-semihosting so it doesn't need to depend on cortex-m 0.8
Diffstat (limited to 'cortex-m-semihosting/src/lib.rs')
-rw-r--r-- | cortex-m-semihosting/src/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cortex-m-semihosting/src/lib.rs b/cortex-m-semihosting/src/lib.rs index 186e7e7..8306307 100644 --- a/cortex-m-semihosting/src/lib.rs +++ b/cortex-m-semihosting/src/lib.rs @@ -194,7 +194,13 @@ pub unsafe fn syscall<T>(nr: usize, arg: &T) -> usize { pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize { match () { #[cfg(all(thumb, not(feature = "no-semihosting")))] - () => cortex_m::asm::semihosting_syscall(_nr as u32, _arg as u32) as usize, + () => { + use core::arch::asm; + let mut nr = _nr as u32; + let arg = _arg as u32; + asm!("bkpt #0xab", inout("r0") nr, in("r1") arg, options(nostack, preserves_flags)); + nr as usize + } #[cfg(all(thumb, feature = "no-semihosting"))] () => 0, #[cfg(not(thumb))] |