aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-semihosting/src
diff options
context:
space:
mode:
authorGravatar bors[bot] <26634292+bors[bot]@users.noreply.github.com> 2020-10-26 22:07:20 +0000
committerGravatar GitHub <noreply@github.com> 2020-10-26 22:07:20 +0000
commite42899b3ed5f6940a9acbe96776993049297cf4f (patch)
treea68cc022356bbfa792802468fec484311291bcec /cortex-m-semihosting/src
parent25f6613a6236d42d448d12b36557824a10ce7a77 (diff)
parent18dca6f5b5a050b8450de52ee9d9879f70c7b058 (diff)
downloadcortex-m-e42899b3ed5f6940a9acbe96776993049297cf4f.tar.gz
cortex-m-e42899b3ed5f6940a9acbe96776993049297cf4f.tar.zst
cortex-m-e42899b3ed5f6940a9acbe96776993049297cf4f.zip
Merge #276
276: Set up GitHub Actions r=adamgreig a=jonas-schievink Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Diffstat (limited to 'cortex-m-semihosting/src')
-rw-r--r--cortex-m-semihosting/src/hio.rs9
-rw-r--r--cortex-m-semihosting/src/lib.rs4
-rw-r--r--cortex-m-semihosting/src/macros.rs9
3 files changed, 9 insertions, 13 deletions
diff --git a/cortex-m-semihosting/src/hio.rs b/cortex-m-semihosting/src/hio.rs
index b0ca2fb..b6b6c7b 100644
--- a/cortex-m-semihosting/src/hio.rs
+++ b/cortex-m-semihosting/src/hio.rs
@@ -1,7 +1,7 @@
//! Host I/O
-use core::{fmt, slice};
use crate::nr;
+use core::{fmt, slice};
/// A byte stream to the host (e.g., host's stdout or stderr).
#[derive(Clone, Copy)]
@@ -38,8 +38,7 @@ pub fn hstdout() -> Result<HostStream, ()> {
fn open(name: &str, mode: usize) -> Result<HostStream, ()> {
let name = name.as_bytes();
- match unsafe { syscall!(OPEN, name.as_ptr(), mode, name.len() - 1) } as
- isize {
+ match unsafe { syscall!(OPEN, name.as_ptr(), mode, name.len() - 1) } as isize {
-1 => Err(()),
fd => Ok(HostStream { fd: fd as usize }),
}
@@ -53,9 +52,7 @@ fn write_all(fd: usize, mut buffer: &[u8]) -> Result<(), ()> {
// `n` bytes were not written
n if n <= buffer.len() => {
let offset = (buffer.len() - n) as isize;
- buffer = unsafe {
- slice::from_raw_parts(buffer.as_ptr().offset(offset), n)
- }
+ buffer = unsafe { 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,...
diff --git a/cortex-m-semihosting/src/lib.rs b/cortex-m-semihosting/src/lib.rs
index de52ae1..05455ce 100644
--- a/cortex-m-semihosting/src/lib.rs
+++ b/cortex-m-semihosting/src/lib.rs
@@ -218,9 +218,7 @@ pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize {
}
#[cfg(all(thumb, feature = "no-semihosting"))]
- () => {
- 0
- }
+ () => 0,
#[cfg(not(thumb))]
() => unimplemented!(),
diff --git a/cortex-m-semihosting/src/macros.rs b/cortex-m-semihosting/src/macros.rs
index d10cd3f..f1cc4f3 100644
--- a/cortex-m-semihosting/src/macros.rs
+++ b/cortex-m-semihosting/src/macros.rs
@@ -11,12 +11,13 @@ macro_rules! syscall {
$crate::syscall($crate::nr::$nr, &[$a1 as usize, $a2 as usize])
};
($nr:ident, $a1:expr, $a2:expr, $a3:expr) => {
- $crate::syscall($crate::nr::$nr, &[$a1 as usize, $a2 as usize,
- $a3 as usize])
+ $crate::syscall($crate::nr::$nr, &[$a1 as usize, $a2 as usize, $a3 as usize])
};
($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr) => {
- $crate::syscall($crate::nr::$nr, &[$a1 as usize, $a2 as usize,
- $a3 as usize, $a4 as usize])
+ $crate::syscall(
+ $crate::nr::$nr,
+ &[$a1 as usize, $a2 as usize, $a3 as usize, $a4 as usize],
+ )
};
}