Skip to content

Commit

Permalink
Put inline asm directly into cortex-m-semihosting so it doesn't need …
Browse files Browse the repository at this point in the history
…to depend on cortex-m 0.8
  • Loading branch information
adamgreig committed Feb 25, 2022
1 parent b49bcbe commit e58d223
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cortex-m-semihosting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down

0 comments on commit e58d223

Please sign in to comment.