From b0f8a82036334835decaf71d3336c7b80089e862 Mon Sep 17 00:00:00 2001 From: gibbz00 Date: Mon, 30 Jun 2025 14:38:06 +0200 Subject: [PATCH 1/3] chore(riscv-rt): remove outdated abort comment in `link.x.in` See: f652ef5d42d931c483d895aabbdb7097d5f25716 --- riscv-rt/link.x.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/riscv-rt/link.x.in b/riscv-rt/link.x.in index 5d798400..0ef9bb02 100644 --- a/riscv-rt/link.x.in +++ b/riscv-rt/link.x.in @@ -93,7 +93,7 @@ SECTIONS . = ALIGN(4); *(.trap); *(.trap.rust); - *(.text.abort); /* close to .init section to support j abort */ + *(.text.abort); *(.text .text.*); . = ALIGN(4); From 9f82208f1df1d14863d1e4848b8289304288efc8 Mon Sep 17 00:00:00 2001 From: gibbz00 Date: Mon, 30 Jun 2025 14:55:40 +0200 Subject: [PATCH 2/3] docs(riscv-rt): make feature flag descriptions more succinct Avoids referring to how cargo features work with an example of how to use them for every feature mentioned. --- riscv-rt/src/lib.rs | 52 +++++++++++---------------------------------- 1 file changed, 12 insertions(+), 40 deletions(-) diff --git a/riscv-rt/src/lib.rs b/riscv-rt/src/lib.rs index 498c46a3..92b5d471 100644 --- a/riscv-rt/src/lib.rs +++ b/riscv-rt/src/lib.rs @@ -478,9 +478,12 @@ //! //! # Cargo Features //! +//! Those unfamiliar with crate dependency features may want to first refer to +//! [The Cargo Book](https://doc.rust-lang.org/cargo/reference/features.html#dependency-features) +//! for a quick rundown on they work. +//! //! ## `pre-init` //! -//! The pre-init feature (`pre-init`) can be activated via [Cargo features](https://doc.rust-lang.org/cargo/reference/features.html). //! When enabled, the runtime will execute the `__pre_init` function to be run **before RAM is initialized**. //! If the feature is enabled, the `__pre_init` function must be defined in the user code (i.e., no default implementation is //! provided by this crate). If the feature is disabled, the `__pre_init` function is not required. @@ -494,29 +497,13 @@ //! //! ## `single-hart` //! -//! The single hart feature (`single-hart) can be activated via [Cargo features](https://doc.rust-lang.org/cargo/reference/features.html). -//! -//! For example: -//! ``` text -//! [dependencies] -//! riscv-rt = {features=["single-hart"]} -//! ``` -//! -//! This feature saves a little code size if there is only one hart on the target. +//! Saves a little code size if there is only one hart on the target. //! //! ## `s-mode` //! -//! The supervisor mode feature (`s-mode`) can be activated via [Cargo features](https://doc.rust-lang.org/cargo/reference/features.html). -//! -//! For example: -//! ``` text -//! [dependencies] -//! riscv-rt = {features=["s-mode"]} -//! ``` -//! -//! While most registers/instructions have variants for -//! both `mcause` and `scause`, the `mhartid` hardware thread register is not available in supervisor -//! mode. Instead, the hartid is passed as parameter by a bootstrapping firmware (i.e., SBI). +//! Supervisor mode. While most registers/instructions have variants for both `mcause` and +//! `scause`, the `mhartid` hardware thread register is not available in supervisor mode. +//! Instead, the hartid is passed as parameter by a bootstrapping firmware (i.e., SBI). //! //! Use case: QEMU supports [OpenSBI](https://github.com/riscv-software-src/opensbi) as default firmware. //! Using the SBI requires riscv-rt to be run in supervisor mode instead of machine mode. @@ -535,28 +522,13 @@ //! //! ## `v-trap` //! -//! The vectored trap feature (`v-trap`) can be activated via [Cargo features](https://doc.rust-lang.org/cargo/reference/features.html). -//! -//! For example: -//! ``` text -//! [dependencies] -//! riscv-rt = {features=["v-trap"]} -//! ``` -//! -//! When the vectored trap feature is enabled, the trap vector is set to `_vector_table` in vectored mode. -//! This table is a list of `j _start_INTERRUPT_trap` instructions, where `INTERRUPT` is the name of the core interrupt. +//! When vectored trap handling is enabled, the trap vector is set to `_vector_table` in vectored mode. +//! This table is a list of `j _start_INTERRUPT_trap` instructions, where `INTERRUPT` is the name of the +//! core interrupt. //! //! ## `u-boot` //! -//! The U-boot support feature (`u-boot`) can be activated via [Cargo features](https://doc.rust-lang.org/cargo/reference/features.html). -//! -//! For example: -//! ``` text -//! [dependencies] -//! riscv-rt = { features = ["u-boot"] } -//! ``` -//! -//! When the `u-boot` feature is enabled, acceptable signature for `#[entry]` macros is changed. This is required +//! When the U-boot feature is enabled, acceptable signature for `#[entry]` macros is changed. This is required //! because when booting from elf, U-boot passes `argc` and `argv`. This feature also implies `single-hart`. //! The only way to get boot-hart is through fdt, so other harts initialization is up to you. //! From 72a7ed99f9ca634e291ee2dc179c09efadf93758 Mon Sep 17 00:00:00 2001 From: gibbz00 Date: Mon, 30 Jun 2025 15:02:18 +0200 Subject: [PATCH 3/3] docs(riscv-rt): mention that no features flags are enabled by default --- riscv-rt/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/riscv-rt/src/lib.rs b/riscv-rt/src/lib.rs index 92b5d471..c7af5ed7 100644 --- a/riscv-rt/src/lib.rs +++ b/riscv-rt/src/lib.rs @@ -480,7 +480,7 @@ //! //! Those unfamiliar with crate dependency features may want to first refer to //! [The Cargo Book](https://doc.rust-lang.org/cargo/reference/features.html#dependency-features) -//! for a quick rundown on they work. +//! for a quick rundown on they work. None are enabled by default. //! //! ## `pre-init` //!