Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

korken89's J-Link fix behind a feature flag #39

Merged
merged 1 commit into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ version = "0.3.4"

[features]
inline-asm = []
jlink-quirks = []

[dependencies]
cortex-m = ">= 0.5.8, < 0.7"
4 changes: 4 additions & 0 deletions src/hio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ fn write_all(fd: usize, mut buffer: &[u8]) -> Result<(), ()> {
slice::from_raw_parts(buffer.as_ptr().offset(offset), n)
}
}
#[cfg(feature = "jlink-quirks")]
// Error (-1) - should be an error but JLink can return -1, -2, -3,...
// For good measure, we allow up to negative 15.
n if n > 0xfffffff0 => return Ok(()),
// Error
_ => return Err(()),
}
Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@
//! When this feature is disabled semihosting is implemented using FFI calls into an external
//! assembly file and compiling this crate works on stable and beta.
//!
//! ## `jlink-quirks`
//!
//! When this feature is enabled, return values above `0xfffffff0` from semihosting operation
//! `SYS_WRITE` (0x05) are interpreted as if the entire buffer had been written. The current
//! latest version 6.48b of J-Link exhibits such behaviour, causing a panic if this feature
//! is not enabled.
//!
//! # Reference
//!
//! For documentation about the semihosting operations, check:
Expand Down