Skip to content

Commit 33dd9f5

Browse files
committed
Adapt riscv-peripheral to edition 2024
1 parent ae39850 commit 33dd9f5

File tree

11 files changed

+21
-15
lines changed

11 files changed

+21
-15
lines changed

.github/workflows/riscv-peripheral.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.75.0
15-
toolchain: [ stable, nightly, 1.75.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-peripheral/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Update to Rust edition 2024 (MSRV 1.85)
13+
1014
## [v0.3.0] - 2025-06-10
1115

1216
### Changed

riscv-peripheral/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "riscv-peripheral"
33
version = "0.3.0"
4-
edition = "2021"
5-
rust-version = "1.75"
4+
edition = "2024"
5+
rust-version = "1.85"
66
repository = "https://github.com/rust-embedded/riscv"
77
authors = ["The RISC-V Team <risc-v@teams.rust-embedded.org>"]
88
categories = ["embedded", "hardware-support", "no-std"]

riscv-peripheral/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This project is developed and maintained by the [RISC-V team][team].
1111

1212
## Minimum Supported Rust Version (MSRV)
1313

14-
This crate is guaranteed to compile on stable Rust 1.75 and up. It *might*
14+
This crate is guaranteed to compile on stable Rust 1.85 and up. It **won't**
1515
compile with older versions but that may change in any new patch release.
1616

1717
## License

riscv-peripheral/src/aclint.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ impl<C: Clint> CLINT<C> {
7878
/// Enabling the `CLINT` may break mask-based critical sections.
7979
#[inline]
8080
pub unsafe fn enable(self) {
81-
self.mswi().enable();
82-
self.mtimer().enable();
81+
unsafe {
82+
self.mswi().enable();
83+
self.mtimer().enable();
84+
}
8385
}
8486

8587
/// Disables machine timer **AND** software interrupts to prevent the CLINT from triggering interrupts.

riscv-peripheral/src/aclint/mswi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<M: Mswi> MSWI<M> {
6464
/// Enabling interrupts may break mask-based critical sections.
6565
#[inline]
6666
pub unsafe fn enable(self) {
67-
mie::set_msoft();
67+
unsafe { mie::set_msoft() };
6868
}
6969

7070
/// Disables machine software interrupts in the current HART.

riscv-peripheral/src/aclint/mtimer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl<M: Mtimer> MTIMER<M> {
8181
/// Enabling interrupts may break mask-based critical sections.
8282
#[inline]
8383
pub unsafe fn enable(self) {
84-
mie::set_mtimer();
84+
unsafe { mie::set_mtimer() };
8585
}
8686

8787
/// Disables machine timer interrupts in the current HART.

riscv-peripheral/src/aclint/sswi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<S: Sswi> SSWI<S> {
5555
/// Enabling interrupts may break mask-based critical sections.
5656
#[inline]
5757
pub unsafe fn enable(self) {
58-
sie::set_ssoft();
58+
unsafe { sie::set_ssoft() };
5959
}
6060

6161
/// Disables supervisor software interrupts in the current HART.

riscv-peripheral/src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ macro_rules! peripheral {
265265
#[inline]
266266
pub const unsafe fn new(address: usize) -> Self {
267267
Self {
268-
register: $crate::common::Reg::new(address as _),
268+
register: unsafe { $crate::common::Reg::new(address as _) },
269269
}
270270
}
271271
}

riscv-peripheral/src/plic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<P: Plic> PLIC<P> {
7272
/// Enabling the `PLIC` may break mask-based critical sections.
7373
#[inline]
7474
pub unsafe fn enable(self) {
75-
mie::set_mext();
75+
unsafe { mie::set_mext() };
7676
}
7777

7878
/// Disables machine external interrupts to prevent the PLIC from triggering interrupts.

0 commit comments

Comments
 (0)