Skip to content
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
4 changes: 3 additions & 1 deletion .github/workflows/riscv-rt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:
run: RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --package riscv-rt --target ${{ matrix.target }} --example ${{ matrix.example }} --features=s-mode,single-hart,v-trap
- name : Build (u-boot)
run: RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --package riscv-rt --target ${{ matrix.target }} --example empty --features=u-boot
- name : Build (defmt)
run: RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --package riscv-rt --target ${{ matrix.target }} --example empty --features=defmt

build-others:
strategy:
Expand All @@ -71,7 +73,7 @@ jobs:
- name: Build (no features)
run: cargo build --package riscv-rt
- name: Build (all features but u-boot)
run: cargo build --package riscv-rt --features=s-mode,single-hart,v-trap
run: cargo build --package riscv-rt --features=s-mode,single-hart,v-trap,defmt
- name: Build (u-boot)
run: cargo build --package riscv-rt --features=u-boot

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/riscv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- name: Test (no features)
run: cargo test --package riscv
# defmt linking fails if not on an ELF platform (https://defmt.ferrous-systems.com/#current-limitations)
- name: Test (all features)
if: matrix.os == 'ubuntu-latest'
run: cargo test --package riscv --all-features
- name: Test (all features except defmt)
if: matrix.os != 'ubuntu-latest'
run: cargo test --package riscv --no-default-features --features riscv-macros,s-mode,critical-section-single-hart,rt,rt-v-trap

# Job to check that all the builds succeeded
build-check:
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ default-members = [
"riscv-semihosting",
"riscv-types",
]

[workspace.dependencies]
defmt = "1.1.1"
1 change: 1 addition & 0 deletions riscv-rt/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
with the ID of the running hart. This allows users to implement hart-specific
interrupt setup in multi-hart targets.
- Use macros from `riscv-macros` instead of `riscv-rt-macros`
- Updated minimum defmt to `1.1.1`, which fixes an FCW

### Removed

Expand Down
4 changes: 2 additions & 2 deletions riscv-rt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ riscv = { path = "../riscv", version = "0.16.1", features = ["rt"] }
riscv-types = { path = "../riscv-types", version = "0.1.0" }
riscv-macros = { path = "../riscv-macros", version = "0.4.1", features = ["riscv-rt"] }

defmt = { version = "1.0.1", optional = true }
defmt = { workspace = true, optional = true }

[dev-dependencies]
panic-halt = "1.0.0"
Expand All @@ -52,5 +52,5 @@ no-xie-xip = []
no-xtvec = []
device = []
memory = []
defmt = ["dep:defmt"]
defmt = ["dep:defmt", "riscv/defmt", "riscv-types/defmt"]
pre-default-start-trap = ["riscv-macros/rvrt-pre-default-start-trap"]
6 changes: 5 additions & 1 deletion riscv-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added

- Add new feature `defmt` which will optionally derive `defmt::Format` on `result::Error`.

## v0.1.0 - 2025-12-19

### Changed
Expand All @@ -29,7 +33,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Classify interrupt numbers in `CoreInterruptNumber` and `ExternalInterruptNumber`.
- Added simple tests to illustrate how to implement all the provided traits.

### Changed
### Changed

- All traits now work with `usize` data type.

Expand Down
6 changes: 6 additions & 0 deletions riscv-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ targets = [
"riscv32i-unknown-none-elf", "riscv32imc-unknown-none-elf", "riscv32imac-unknown-none-elf",
"riscv64imac-unknown-none-elf", "riscv64gc-unknown-none-elf",
]

[dependencies]
defmt = { workspace = true, optional = true }

[features]
defmt = ["dep:defmt"]
1 change: 1 addition & 0 deletions riscv-types/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub type Result<T> = core::result::Result<T, Error>;
/// Represents error variants for the library.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[non_exhaustive]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Error {
/// Attempted out-of-bounds access.
IndexOutOfBounds {
Expand Down
1 change: 1 addition & 0 deletions riscv/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Added

- Add new feature `defmt` which will optionally derive `defmt::Format` on certain types.
- Add `stimecmp`/`stimecmph` CSRs
- Add `tselect`, `tdata2` and `tdata3` Sdtrig CSRs as raw `read_write_csr_as_usize!` accessors, and `tdata1` and `tcontrol` as typed CSRs with field accessors.
- Add `read_bits`/`try_read_bits` and `write_bits`/`try_write_bits` to the modules generated by `read_csr_as_usize!` and `write_csr_as_usize!`, as aliases of `read`/`write` so that a generated CSR module offers the same raw accessors no matter which macro defined it.
Expand Down
2 changes: 2 additions & 0 deletions riscv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ s-mode = []
critical-section-single-hart = ["critical-section/restore-state-bool"]
rt = ["riscv-macros/rt"]
rt-v-trap = ["rt", "riscv-macros/rt-v-trap"]
defmt = ["dep:defmt", "riscv-types/defmt"]

[dependencies]
critical-section = "1.2.0"
embedded-hal = "1.0.0"
defmt = { workspace = true, optional = true }
riscv-types = { path = "../riscv-types", version = "0.1.0" }
riscv-macros = { path = "../riscv-macros", version = "0.4.1", optional = true }
pastey = "0.2.2"
1 change: 1 addition & 0 deletions riscv/src/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pub enum Trap<I, E> {

/// Trap Error
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TrapError {
InvalidInterrupt(usize),
InvalidException(usize),
Expand Down
2 changes: 2 additions & 0 deletions riscv/src/interrupt/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{

/// Standard M-mode RISC-V interrupts
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[repr(usize)]
pub enum Interrupt {
SupervisorSoft = 1,
Expand Down Expand Up @@ -45,6 +46,7 @@ unsafe impl CoreInterruptNumber for Interrupt {}

/// Standard M-mode RISC-V exceptions
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[repr(usize)]
pub enum Exception {
InstructionMisaligned = 0,
Expand Down
2 changes: 2 additions & 0 deletions riscv/src/interrupt/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{

/// Interrupt
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[repr(usize)]
pub enum Interrupt {
SupervisorSoft = 1,
Expand Down Expand Up @@ -39,6 +40,7 @@ unsafe impl CoreInterruptNumber for Interrupt {}

/// Exception
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[repr(usize)]
pub enum Exception {
InstructionMisaligned = 0,
Expand Down
Loading