Skip to content

Commit 4d46022

Browse files
committed
Fix v-trap core interrupt
1 parent 86f649d commit 4d46022

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

riscv-rt/CHANGELOG.md

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

2222
### Fixed
2323

24+
- Fix v-trap core interrupt so RISCV_RT_BASE_ISA must be defined
2425
- Fix undefined behavior in heap initialization example documentation
2526
- Fix stack allocation algorithm for multi-core targets without M extension
2627

riscv-rt/macros/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
783783
/// The argument of the macro must be a path to a variant of an enum that implements the `riscv_rt::CoreInterruptNumber` trait.
784784
///
785785
/// If the `v-trap` feature is enabled, this macro generates the corresponding interrupt trap handler in assembly.
786+
/// This feature relies on the `RISCV_RT_BASE_ISA` environment variable being set to one of
787+
/// `rv32i`, `rv32e`, `rv64i`, or `rv64e`. Otherwise, this will **panic**.
786788
///
787789
/// # Example
788790
///
@@ -795,7 +797,7 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
795797
pub fn core_interrupt(args: TokenStream, input: TokenStream) -> TokenStream {
796798
let arch = match () {
797799
#[cfg(feature = "v-trap")]
798-
() => RiscvArch::try_from_env(),
800+
() => Some(RiscvArch::try_from_env().expect("RISCV_RT_BASE_ISA must be defined")),
799801
#[cfg(not(feature = "v-trap"))]
800802
() => None,
801803
};

0 commit comments

Comments
 (0)