This repository was archived by the owner on Dec 2, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ edition = "2018"
1616[features ]
1717inline-asm = []
1818jlink-quirks = []
19+ no-semihosting = []
1920
2021[dependencies ]
2122cortex-m = " >= 0.5.8, < 0.7"
Original file line number Diff line number Diff line change 170170//! latest version 6.48b of J-Link exhibits such behaviour, causing a panic if this feature
171171//! is not enabled.
172172//!
173+ //! ## `no-semihosting`
174+ //!
175+ //! When this feature is enabled, the underlying system calls to `bkpt` are patched out.
176+ //!
173177//! # Reference
174178//!
175179//! For documentation about the semihosting operations, check:
@@ -207,16 +211,21 @@ pub unsafe fn syscall<T>(nr: usize, arg: &T) -> usize {
207211#[ inline( always) ]
208212pub unsafe fn syscall1 ( _nr : usize , _arg : usize ) -> usize {
209213 match ( ) {
210- #[ cfg( all( thumb, not( feature = "inline-asm" ) ) ) ]
214+ #[ cfg( all( thumb, not( feature = "inline-asm" ) , not ( feature = "no-semihosting" ) ) ) ]
211215 ( ) => __syscall ( _nr, _arg) ,
212216
213- #[ cfg( all( thumb, feature = "inline-asm" ) ) ]
217+ #[ cfg( all( thumb, feature = "inline-asm" , not ( feature = "no-semihosting" ) ) ) ]
214218 ( ) => {
215219 let mut nr = _nr;
216220 llvm_asm ! ( "bkpt 0xAB" : "+{r0}" ( nr) : "{r1}" ( _arg) :: "volatile" ) ;
217221 nr
218222 }
219223
224+ #[ cfg( all( thumb, feature = "no-semihosting" ) ) ]
225+ ( ) => {
226+ 0
227+ }
228+
220229 #[ cfg( not( thumb) ) ]
221230 ( ) => unimplemented ! ( ) ,
222231 }
You can’t perform that action at this time.
0 commit comments