Skip to content

Commit 4c9c333

Browse files
committed
Update documentation
1 parent dc19d13 commit 4c9c333

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

riscv-rt/build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ fn main() {
4747
// make sure that these env variables are not changed without notice.
4848
println!("cargo:rerun-if-env-changed=RISCV_RT_BASE_ISA");
4949
println!("cargo:rerun-if-env-changed=RISCV_RT_LLVM_ARCH_PATCH");
50+
if env::var_os("CARGO_FEATURE_V_TRAP").is_some()
51+
&& env::var_os("CARGO_FEATURE_NO_INTERRUPTS").is_none()
52+
{
53+
// This environment variable is used by the `#[riscv::pac_enum()]` call in
54+
// `src/interrupts.rs` (when `v-trap` is enabled and `no-interrupts` disabled).
55+
println!("cargo:rerun-if-env-changed=RISCV_MTVEC_ALIGN");
56+
}
5057

5158
for flag in target.rustc_flags() {
5259
// Required until target_feature risc-v is stable and in-use

riscv-rt/src/interrupts.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
//!
88
//! In vectored mode (i.e., `v-trap` feature enabled), interrupt dispatching is handled by hardware.
99
//! To support this mode, we provide inline assembly code that defines the interrupt vector table.
10+
//! Since the alignment constraint of this vector table is implementation-specific, it can be
11+
//! changed by setting the `RISCV_MTVEC_ALIGN` environment variable (the default is 4).
1012
//!
1113
//! # Note
1214
//!
13-
//! If your target has custom core interrupt sources, the target PAC might provide equivalent
14-
//! code to adapt for the target needs. In this case, you may need to opt out this module.
15-
//! To do so, activate the `no-interrupts` feature of the `riscv-rt` crate.
15+
//! If your target has custom core interrupt sources, the target PAC might provide equivalent code
16+
//! to adapt for the target needs (and is responsible for any alignment constraint). In this case,
17+
//! you may need to opt out this module. To do so, activate the `no-interrupts` feature of the
18+
//! `riscv-rt` crate.
1619
1720
// In vectored mode, we also must provide a vector table
1821
#[riscv::pac_enum(unsafe CoreInterruptNumber)]

0 commit comments

Comments
 (0)