Skip to content

Commit e58d223

Browse files
committed
Put inline asm directly into cortex-m-semihosting so it doesn't need to depend on cortex-m 0.8
1 parent b49bcbe commit e58d223

File tree

1 file changed

+7
-1
lines changed
  • cortex-m-semihosting/src

1 file changed

+7
-1
lines changed

cortex-m-semihosting/src/lib.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,13 @@ pub unsafe fn syscall<T>(nr: usize, arg: &T) -> usize {
194194
pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize {
195195
match () {
196196
#[cfg(all(thumb, not(feature = "no-semihosting")))]
197-
() => cortex_m::asm::semihosting_syscall(_nr as u32, _arg as u32) as usize,
197+
() => {
198+
use core::arch::asm;
199+
let mut nr = _nr as u32;
200+
let arg = _arg as u32;
201+
asm!("bkpt #0xab", inout("r0") nr, in("r1") arg, options(nostack, preserves_flags));
202+
nr as usize
203+
},
198204
#[cfg(all(thumb, feature = "no-semihosting"))]
199205
() => 0,
200206
#[cfg(not(thumb))]

0 commit comments

Comments
 (0)