Document the features of the remaining packages (#1143)

* Document features for `esp-riscv-rt` package

* Document features for `esp-hal-smartled`

* Document features for `esp-hal-procmacros`
This commit is contained in:
Jesse Braham 2024-02-06 15:12:05 +00:00 committed by GitHub
parent 0f12654f4a
commit ac07f3c460
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 105 additions and 53 deletions

View File

@ -15,6 +15,7 @@ proc-macro = true
[dependencies] [dependencies]
darling = "0.20.3" darling = "0.20.3"
document-features = "0.2.7"
litrs = "0.4.1" litrs = "0.4.1"
object = { version = "0.32.1", optional = true } object = { version = "0.32.1", optional = true }
proc-macro-crate = "2.0.1" proc-macro-crate = "2.0.1"
@ -24,22 +25,37 @@ quote = "1.0.33"
syn = { version = "2.0.40", features = ["extra-traits", "full"] } syn = { version = "2.0.40", features = ["extra-traits", "full"] }
[features] [features]
# Select a target device: ## Provide a `#[main]` procmacro to mark the entry point for Embassy applications.
esp32 = []
esp32c2 = []
esp32c3 = []
esp32c6 = ["dep:object"]
esp32c6-lp = []
esp32h2 = []
esp32p4 = []
esp32s2 = ["dep:object"]
esp32s2-ulp = []
esp32s3 = ["dep:object"]
esp32s3-ulp = []
# Gated features:
embassy = [] embassy = []
## Provide enum dispatch helpers.
enum-dispatch = [] enum-dispatch = []
## Provide an `#[interrupt]` procmacro for defining interrupt service routines.
interrupt = [] interrupt = []
## Provide a `#[ram]` procmacro to place functions in RAM instead of flash.
ram = [] ram = []
## Indicates the target devices has RTC slow memory available.
rtc_slow = [] rtc_slow = []
#! ### Chip Support Feature Flags
## Target the ESP32.
esp32 = []
## Target the ESP32-C2.
esp32c2 = []
## Target the ESP32-C3.
esp32c3 = []
## Target the ESP32-C6.
esp32c6 = ["dep:object"]
## Target the ESP32-C6's low-power core.
esp32c6-lp = []
## Target the ESP32-H2.
esp32h2 = []
## Target the ESP32-P4.
esp32p4 = []
## Target the ESP32-S2.
esp32s2 = ["dep:object"]
## Target the ESP32-S2's ultra-low-power core.
esp32s2-ulp = []
## Target the ESP32-S3.
esp32s3 = ["dep:object"]
## Target the ESP32-S3's ultra-low-power core.
esp32s3-ulp = []

View File

@ -70,7 +70,9 @@
//! #[ram(rtc_fast, zeroed)] //! #[ram(rtc_fast, zeroed)]
//! static mut SOME_ZEROED_DATA: [u8; 8] = [0; 8]; //! static mut SOME_ZEROED_DATA: [u8; 8] = [0; 8];
//! ``` //! ```
//!
//! ## Feature Flags
#![doc = document_features::document_features!()]
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")] #![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")]
#[cfg(feature = "ram")] #[cfg(feature = "ram")]

View File

@ -9,22 +9,35 @@ license = "MIT OR Apache-2.0"
[package.metadata.docs.rs] [package.metadata.docs.rs]
features = ["esp32c3"] features = ["esp32c3"]
targets = ["riscv32imc-unknown-none-elf"]
[dependencies] [dependencies]
defmt = { version = "=0.3.5", optional = true } defmt = { version = "=0.3.5", optional = true }
document-features = "0.2.7"
esp-hal = { version = "0.15.0", path = "../esp-hal" } esp-hal = { version = "0.15.0", path = "../esp-hal" }
fugit = "0.3.7" fugit = "0.3.7"
smart-leds-trait = "0.3.0" smart-leds-trait = "0.3.0"
[features] [features]
## Implement `defmt::Format` on certain types.
defmt = ["dep:defmt", "esp-hal/defmt"]
#! ### Chip Support Feature Flags
## Target the ESP32.
esp32 = ["esp-hal/esp32"] esp32 = ["esp-hal/esp32"]
## Target the ESP32-C3.
esp32c3 = ["esp-hal/esp32c3"] esp32c3 = ["esp-hal/esp32c3"]
## Target the ESP32-C6.
esp32c6 = ["esp-hal/esp32c6"] esp32c6 = ["esp-hal/esp32c6"]
## Target the ESP32-H2.
esp32h2 = ["esp-hal/esp32h2"] esp32h2 = ["esp-hal/esp32h2"]
## Target the ESP32-S2.
esp32s2 = ["esp-hal/esp32s2"] esp32s2 = ["esp-hal/esp32s2"]
## Target the ESP32-S3.
esp32s3 = ["esp-hal/esp32s3"] esp32s3 = ["esp-hal/esp32s3"]
#! ### Crystal Frequency Feature Flags
## Target device has a 26MHz crystal.
xtal-26mhz = ["esp-hal/xtal-26mhz"] xtal-26mhz = ["esp-hal/xtal-26mhz"]
## Target device has a 40MHz crystal.
xtal-40mhz = ["esp-hal/xtal-40mhz"] xtal-40mhz = ["esp-hal/xtal-40mhz"]
defmt = ["dep:defmt", "esp-hal/defmt"]

View File

@ -2,11 +2,11 @@
//! with RGB LEDs and use the convenience functions of the //! with RGB LEDs and use the convenience functions of the
//! [`smart-leds`](https://crates.io/crates/smart-leds) crate. //! [`smart-leds`](https://crates.io/crates/smart-leds) crate.
//! //!
//! _This is a simple implementation where every LED is adressed in an //! This is a simple implementation where every LED is adressed in an
//! individual RMT operation. This is working perfectly fine in blocking mode, //! individual RMT operation. This is working perfectly fine in blocking mode,
//! but in case this is used in combination with interrupts that might disturb //! but in case this is used in combination with interrupts that might disturb
//! the sequential sending, an alternative implementation (addressing the LEDs //! the sequential sending, an alternative implementation (addressing the LEDs
//! in a sequence in a single RMT send operation) might be required!_ //! in a sequence in a single RMT send operation) might be required!
//! //!
//! ## Example //! ## Example
//! //!
@ -17,10 +17,12 @@
//! let rmt_buffer = smartLedBuffer!(1); //! let rmt_buffer = smartLedBuffer!(1);
//! let mut led = SmartLedsAdapter::new(rmt.channel0, io.pins.gpio2, rmt_buffer); //! let mut led = SmartLedsAdapter::new(rmt.channel0, io.pins.gpio2, rmt_buffer);
//! ``` //! ```
//!
#![no_std] //! ## Feature Flags
#![deny(missing_docs)] #![doc = document_features::document_features!()]
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")] #![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")]
#![deny(missing_docs)]
#![no_std]
use core::{fmt::Debug, slice::IterMut}; use core::{fmt::Debug, slice::IterMut};

View File

@ -10,21 +10,37 @@ keywords = ["esp32", "riscv", "runtime", "startup"]
categories = ["embedded", "no-std"] categories = ["embedded", "no-std"]
[dependencies] [dependencies]
document-features = "0.2.7"
riscv = "0.11.0" riscv = "0.11.0"
riscv-rt-macros = "0.2.1" riscv-rt-macros = "0.2.1"
[features] [features]
direct-vectoring = [] ## Move the stack to the start of RAM to get zero-cost stack overflow
## protection (ESP32-C6 and ESP32-H2 only!)
fix-sp = [] fix-sp = []
## Indicate that the device supports `mie` and `mip` instructions.
has-mie-mip = [] has-mie-mip = []
#! ### Memory Initialization Feature Flags
## Initialize the `data` section.
init-data = [] init-data = []
## Initialize the `.rtc_fast.data` section.
init-rtc-fast-data = [] init-rtc-fast-data = []
## Initialize the `.rtc_fast.text` section.
init-rtc-fast-text = [] init-rtc-fast-text = []
## Initialize the `.rwtext` section.
init-rw-text = [] init-rw-text = []
interrupt-preemption = [] ## Zero the `.bss` section.
zero-bss = [] zero-bss = []
## Zero the `.rtc_fast.bss` section.
zero-rtc-fast-bss = [] zero-rtc-fast-bss = []
#! ### Interrupt Feature Flags
## Enable direct interrupt vectoring.
direct-vectoring = []
## Enable interrupt preemption.
interrupt-preemption = []
# This feature is intended for testing; you probably don't want to enable it: # This feature is intended for testing; you probably don't want to enable it:
ci = [ ci = [
"direct-vectoring", "direct-vectoring",

View File

@ -1,14 +1,17 @@
//! Minimal startup / runtime for RISC-V CPUs from Espressif //! Minimal startup/runtime for RISC-V CPUs from Espressif.
//! //!
//! # Features //! ## Features
//! //!
//! This crate provides: //! This crate provides:
//! //!
//! - Before main initialization of the `.bss` and `.data` sections controlled //! - Before main initialization of the `.bss` and `.data` sections controlled
//! by features //! by features
//! - `#[entry]` to declare the entry point of the program //! - `#[entry]` to declare the entry point of the program
//!
// NOTE: Adapted from riscv-rt/src/lib.rs //! ## Feature Flags
#![doc = document_features::document_features!()]
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")]
#![deny(missing_docs)]
#![no_std] #![no_std]
use core::arch::global_asm; use core::arch::global_asm;