Skip to content

Commit cdae64a

Browse files
Merge pull request #318 from gibbz00/succinct_features
docs(riscv-rt): make feature flag descriptions more succinct
2 parents f0ed17b + 72a7ed9 commit cdae64a

File tree

2 files changed

+13
-41
lines changed

2 files changed

+13
-41
lines changed

riscv-rt/link.x.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ SECTIONS
9393
. = ALIGN(4);
9494
*(.trap);
9595
*(.trap.rust);
96-
*(.text.abort); /* close to .init section to support j abort */
96+
*(.text.abort);
9797
*(.text .text.*);
9898

9999
. = ALIGN(4);

riscv-rt/src/lib.rs

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,12 @@
478478
//!
479479
//! # Cargo Features
480480
//!
481+
//! Those unfamiliar with crate dependency features may want to first refer to
482+
//! [The Cargo Book](https://doc.rust-lang.org/cargo/reference/features.html#dependency-features)
483+
//! for a quick rundown on they work. None are enabled by default.
484+
//!
481485
//! ## `pre-init`
482486
//!
483-
//! The pre-init feature (`pre-init`) can be activated via [Cargo features](https://doc.rust-lang.org/cargo/reference/features.html).
484487
//! When enabled, the runtime will execute the `__pre_init` function to be run **before RAM is initialized**.
485488
//! If the feature is enabled, the `__pre_init` function must be defined in the user code (i.e., no default implementation is
486489
//! provided by this crate). If the feature is disabled, the `__pre_init` function is not required.
@@ -494,29 +497,13 @@
494497
//!
495498
//! ## `single-hart`
496499
//!
497-
//! The single hart feature (`single-hart) can be activated via [Cargo features](https://doc.rust-lang.org/cargo/reference/features.html).
498-
//!
499-
//! For example:
500-
//! ``` text
501-
//! [dependencies]
502-
//! riscv-rt = {features=["single-hart"]}
503-
//! ```
504-
//!
505-
//! This feature saves a little code size if there is only one hart on the target.
500+
//! Saves a little code size if there is only one hart on the target.
506501
//!
507502
//! ## `s-mode`
508503
//!
509-
//! The supervisor mode feature (`s-mode`) can be activated via [Cargo features](https://doc.rust-lang.org/cargo/reference/features.html).
510-
//!
511-
//! For example:
512-
//! ``` text
513-
//! [dependencies]
514-
//! riscv-rt = {features=["s-mode"]}
515-
//! ```
516-
//!
517-
//! While most registers/instructions have variants for
518-
//! both `mcause` and `scause`, the `mhartid` hardware thread register is not available in supervisor
519-
//! mode. Instead, the hartid is passed as parameter by a bootstrapping firmware (i.e., SBI).
504+
//! Supervisor mode. While most registers/instructions have variants for both `mcause` and
505+
//! `scause`, the `mhartid` hardware thread register is not available in supervisor mode.
506+
//! Instead, the hartid is passed as parameter by a bootstrapping firmware (i.e., SBI).
520507
//!
521508
//! Use case: QEMU supports [OpenSBI](https://github.com/riscv-software-src/opensbi) as default firmware.
522509
//! Using the SBI requires riscv-rt to be run in supervisor mode instead of machine mode.
@@ -535,28 +522,13 @@
535522
//!
536523
//! ## `v-trap`
537524
//!
538-
//! The vectored trap feature (`v-trap`) can be activated via [Cargo features](https://doc.rust-lang.org/cargo/reference/features.html).
539-
//!
540-
//! For example:
541-
//! ``` text
542-
//! [dependencies]
543-
//! riscv-rt = {features=["v-trap"]}
544-
//! ```
545-
//!
546-
//! When the vectored trap feature is enabled, the trap vector is set to `_vector_table` in vectored mode.
547-
//! This table is a list of `j _start_INTERRUPT_trap` instructions, where `INTERRUPT` is the name of the core interrupt.
525+
//! When vectored trap handling is enabled, the trap vector is set to `_vector_table` in vectored mode.
526+
//! This table is a list of `j _start_INTERRUPT_trap` instructions, where `INTERRUPT` is the name of the
527+
//! core interrupt.
548528
//!
549529
//! ## `u-boot`
550530
//!
551-
//! The U-boot support feature (`u-boot`) can be activated via [Cargo features](https://doc.rust-lang.org/cargo/reference/features.html).
552-
//!
553-
//! For example:
554-
//! ``` text
555-
//! [dependencies]
556-
//! riscv-rt = { features = ["u-boot"] }
557-
//! ```
558-
//!
559-
//! When the `u-boot` feature is enabled, acceptable signature for `#[entry]` macros is changed. This is required
531+
//! When the U-boot feature is enabled, acceptable signature for `#[entry]` macros is changed. This is required
560532
//! because when booting from elf, U-boot passes `argc` and `argv`. This feature also implies `single-hart`.
561533
//! The only way to get boot-hart is through fdt, so other harts initialization is up to you.
562534
//!

0 commit comments

Comments
 (0)