|
478 | 478 | //! |
479 | 479 | //! # Cargo Features |
480 | 480 | //! |
| 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 | +//! |
481 | 485 | //! ## `pre-init` |
482 | 486 | //! |
483 | | -//! The pre-init feature (`pre-init`) can be activated via [Cargo features](https://doc.rust-lang.org/cargo/reference/features.html). |
484 | 487 | //! When enabled, the runtime will execute the `__pre_init` function to be run **before RAM is initialized**. |
485 | 488 | //! If the feature is enabled, the `__pre_init` function must be defined in the user code (i.e., no default implementation is |
486 | 489 | //! provided by this crate). If the feature is disabled, the `__pre_init` function is not required. |
|
494 | 497 | //! |
495 | 498 | //! ## `single-hart` |
496 | 499 | //! |
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. |
506 | 501 | //! |
507 | 502 | //! ## `s-mode` |
508 | 503 | //! |
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). |
520 | 507 | //! |
521 | 508 | //! Use case: QEMU supports [OpenSBI](https://github.com/riscv-software-src/opensbi) as default firmware. |
522 | 509 | //! Using the SBI requires riscv-rt to be run in supervisor mode instead of machine mode. |
|
535 | 522 | //! |
536 | 523 | //! ## `v-trap` |
537 | 524 | //! |
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. |
548 | 528 | //! |
549 | 529 | //! ## `u-boot` |
550 | 530 | //! |
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 |
560 | 532 | //! because when booting from elf, U-boot passes `argc` and `argv`. This feature also implies `single-hart`. |
561 | 533 | //! The only way to get boot-hart is through fdt, so other harts initialization is up to you. |
562 | 534 | //! |
|
0 commit comments