Skip to content

Commit d4ae2d6

Browse files
committed
Adapt riscv-semihosting to edition 2024
1 parent 785eb92 commit d4ae2d6

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

.github/workflows/riscv-semihosting.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
build-riscv:
1212
strategy:
1313
matrix:
14-
# All generated code should be running on stable now, MRSV is 1.67.0
15-
toolchain: [ stable, nightly, 1.67.0 ]
14+
# All generated code should be running on stable now, MRSV is 1.85.0
15+
toolchain: [ stable, nightly, 1.85.0 ]
1616
target:
1717
- riscv32i-unknown-none-elf
1818
- riscv32imc-unknown-none-elf

riscv-semihosting/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ authors = [
44
"Jorge Aparicio <[email protected]>",
55
"The RISC-V Team <[email protected]>",
66
]
7-
description = "Semihosting for RISCV processors"
7+
description = "Semihosting for RISC-V processors"
88
documentation = "https://docs.rs/riscv-semihosting"
99
keywords = ["semihosting", "riscv"]
1010
categories = ["no-std", "embedded"]
@@ -13,8 +13,8 @@ name = "riscv-semihosting"
1313
readme = "README.md"
1414
repository = "https://github.com/riscv-rust/riscv"
1515
version = "0.2.0"
16-
edition = "2021"
17-
rust-version = "1.67"
16+
edition = "2024"
17+
rust-version = "1.85"
1818

1919
[features]
2020
u-mode = []

riscv-semihosting/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ While `riscv-semihosting` is a good starting point for developing semihosted app
3535

3636
# Minimum Supported Rust Version (MSRV)
3737

38-
This crate is guaranteed to compile on stable Rust 1.60.0 and up. It **won't**
38+
This crate is guaranteed to compile on stable Rust 1.85.0 and up. It **won't**
3939
compile with older versions.
4040

4141
## License
4242

43-
Copyright 2018-2023 [RISC-V team][team]
43+
Copyright 2018-2025 [RISC-V team][team]
4444

4545
Permission to use, copy, modify, and/or distribute this software for any purpose
4646
with or without fee is hereby granted, provided that the above copyright notice
@@ -69,4 +69,4 @@ to intervene to uphold that code of conduct.
6969
[CoC]: ../CODE_OF_CONDUCT.md
7070
[team]: https://github.com/rust-embedded/wg#the-risc-v-team
7171
[`semihosting`]: https://crates.io/crates/semihosting
72-
[`cortex-m-semihosting`]: https://docs.rs/cortex-m-semihosting
72+
[`cortex-m-semihosting`]: https://docs.rs/cortex-m-semihosting

riscv-semihosting/src/lib.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ pub mod nr;
202202
/// [semihosting operation]: https://developer.arm.com/documentation/dui0471/i/semihosting/semihosting-operations?lang=en
203203
#[inline(always)]
204204
pub unsafe fn syscall<T>(nr: usize, arg: &T) -> usize {
205-
syscall1(nr, arg as *const T as usize)
205+
unsafe { syscall1(nr, arg as *const T as usize) }
206206
}
207207

208208
/// Performs a semihosting operation, takes one integer as an argument
@@ -221,7 +221,8 @@ pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize {
221221
// it will be treated as a regular break, hence the norvc option.
222222
//
223223
// See https://github.com/riscv/riscv-semihosting-spec for more details.
224-
asm!("
224+
unsafe {
225+
asm!("
225226
.balign 16
226227
.option push
227228
.option norvc
@@ -230,10 +231,11 @@ pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize {
230231
srai x0, x0, 0x7
231232
.option pop
232233
",
233-
inout("a0") nr,
234-
inout("a1") arg => _,
235-
options(nostack, preserves_flags),
236-
);
234+
inout("a0") nr,
235+
inout("a1") arg => _,
236+
options(nostack, preserves_flags),
237+
)
238+
};
237239
nr
238240
}
239241
#[cfg(all(riscv, feature = "no-semihosting"))]

0 commit comments

Comments
 (0)