Skip to content

Commit

Permalink
Merge branch 'main' into c6sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebraham authored Jan 3, 2024
2 parents 224695e + 62ae9dc commit a3ebd3f
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 28 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ jobs:
cargo check --examples --features=embassy,embassy-time-timg0,embassy-executor-interrupt,embassy-executor-thread,log
- name: check esp32-hal (psram)
run: cd esp32-hal/ && cargo check --example=psram --features=psram-2m --release # This example requires release!
# Make sure we can build without default features enabled, too!
- name: check esp32-hal (no default features)
run: cd esp32-hal/ && cargo build --no-default-features --features=xtal-40mhz
# Ensure documentation can be built
- name: rustdoc
run: cd esp32-hal/ && cargo doc --features=eh1
Expand Down Expand Up @@ -209,6 +212,9 @@ jobs:
cd esp32c2-hal/
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,defmt
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,log
# Make sure we can build without default features enabled, too!
- name: check esp32c2-hal (no default features)
run: cd esp32c2-hal/ && cargo build --no-default-features --features=xtal-40mhz
# Ensure documentation can be built
- name: rustdoc
run: cd esp32c2-hal/ && cargo doc --features=eh1
Expand Down Expand Up @@ -263,6 +269,9 @@ jobs:
cd esp32c3-hal/
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,defmt
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,log
# Make sure we can build without default features enabled, too!
- name: check esp32c3-hal (no default features)
run: cd esp32c3-hal/ && cargo build --no-default-features
# Ensure documentation can be built
- name: rustdoc
run: cd esp32c3-hal/ && cargo doc --features=eh1
Expand Down Expand Up @@ -328,6 +337,9 @@ jobs:
cd esp32c6-hal/
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,defmt
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,log
# Make sure we can build without default features enabled, too!
- name: check esp32c6-hal (no default features)
run: cd esp32c6-hal/ && cargo build --no-default-features
# Ensure documentation can be built
- name: rustdoc
run: cd esp32c6-hal/ && cargo doc --features=eh1
Expand Down Expand Up @@ -408,6 +420,9 @@ jobs:
cd esp32h2-hal/
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,defmt
cargo +nightly check --examples --features=embassy,embassy-time-timg0,embassy-executor-thread,log
# Make sure we can build without default features enabled, too!
- name: check esp32h2-hal (no default features)
run: cd esp32h2-hal/ && cargo build --no-default-features
# Ensure documentation can be built
- name: rustdoc
run: cd esp32h2-hal/ && cargo doc --features=eh1
Expand Down Expand Up @@ -483,6 +498,9 @@ jobs:
cargo +esp check --examples --features=embassy,embassy-time-timg0,embassy-executor-interrupt,embassy-executor-thread,log
- name: check esp32s2-hal (psram)
run: cd esp32s2-hal/ && cargo +esp check --example=psram --features=psram-2m --release # This example requires release!
# Make sure we can build without default features enabled, too!
- name: check esp32s2-hal (no default features)
run: cd esp32s2-hal/ && cargo build --no-default-features
# Ensure documentation can be built
- name: rustdoc
run: cd esp32s2-hal/ && cargo +esp doc --features=eh1
Expand Down Expand Up @@ -565,6 +583,9 @@ jobs:
cd esp32s3-hal/
cargo +esp check --examples --features=embassy,embassy-time-timg0,embassy-executor-interrupt,embassy-executor-thread,defmt
cargo +esp check --examples --features=embassy,embassy-time-timg0,embassy-executor-interrupt,embassy-executor-thread,log
# Make sure we can build without default features enabled, too!
- name: check esp32s3-hal (no default features)
run: cd esp32s3-hal/ && cargo build --no-default-features
# Ensure documentation can be built
- name: rustdoc
run: cd esp32s3-hal/ && cargo doc --features=eh1
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- ESP32-C6: Properly initialize PMU (#974)
- Implement overriding base mac address (#1044)
- Add `rt-riscv` and `rt-xtensa` features to enable/disable runtime support (#1057)
- ESP32-C6: Implement deep sleep (#918)

### Changed

### Fixed

- ESP32: correct gpio 32/33 in errata36() (#1053)

### Removed

## [0.14.1] - 2023-12-13
Expand Down
23 changes: 14 additions & 9 deletions esp-hal-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ embassy-sync = { version = "0.5.0", optional = true }
embassy-time = { version = "0.2.0", optional = true }

# RISC-V
esp-riscv-rt = { version = "0.6.0", optional = true, path = "../esp-riscv-rt" }
riscv = { version = "0.10.1", optional = true }
esp-riscv-rt = { version = "0.6.0", optional = true, path = "../esp-riscv-rt" }

# Xtensa
xtensa-lx = { version = "0.8.0", optional = true }
Expand All @@ -73,18 +74,22 @@ basic-toml = "0.1.7"
serde = { version = "1.0.193", features = ["derive"] }

[features]
esp32 = ["xtensa", "esp32/rt", "procmacros/esp32", "xtensa-lx/esp32", "xtensa-lx-rt/esp32"]
esp32c2 = ["riscv", "esp32c2/rt", "procmacros/esp32c2", "portable-atomic/unsafe-assume-single-core"]
esp32c3 = ["riscv", "esp32c3/rt", "procmacros/esp32c3", "portable-atomic/unsafe-assume-single-core"]
esp32c6 = ["riscv", "esp32c6/rt", "procmacros/esp32c6"]
esp32h2 = ["riscv", "esp32h2/rt", "procmacros/esp32h2"]
esp32s2 = ["xtensa", "esp32s2/rt", "procmacros/esp32s2", "xtensa-lx/esp32s2", "xtensa-lx-rt/esp32s2", "usb-otg", "portable-atomic/critical-section"]
esp32s3 = ["xtensa", "esp32s3/rt", "procmacros/esp32s3", "xtensa-lx/esp32s3", "xtensa-lx-rt/esp32s3", "usb-otg"]
esp32 = ["dep:esp32", "xtensa", "procmacros/esp32", "xtensa-lx/esp32", "xtensa-lx-rt?/esp32"]
esp32c2 = ["dep:esp32c2", "riscv", "procmacros/esp32c2", "portable-atomic/unsafe-assume-single-core"]
esp32c3 = ["dep:esp32c3", "riscv", "procmacros/esp32c3", "portable-atomic/unsafe-assume-single-core"]
esp32c6 = ["dep:esp32c6", "riscv", "procmacros/esp32c6"]
esp32h2 = ["dep:esp32h2", "riscv", "procmacros/esp32h2"]
esp32s2 = ["dep:esp32s2", "xtensa", "procmacros/esp32s2", "xtensa-lx/esp32s2", "xtensa-lx-rt?/esp32s2", "usb-otg", "portable-atomic/critical-section"]
esp32s3 = ["dep:esp32s3", "xtensa", "procmacros/esp32s3", "xtensa-lx/esp32s3", "xtensa-lx-rt?/esp32s3", "usb-otg"]

# Crystal frequency selection (ESP32 and ESP32-C2 only!)
xtal-26mhz = []
xtal-40mhz = []

# Runetime support
rt-riscv = ["esp-riscv-rt/zero-bss", "esp32c2?/rt", "esp32c3?/rt", "esp32c6?/rt", "esp32h2?/rt"]
rt-xtensa = ["dep:xtensa-lx-rt", "esp32?/rt", "esp32s2?/rt", "esp32s3?/rt"]

# Only certain chips support flip-link (ESP32-C6 and ESPS32-H2)
flip-link = ["esp-riscv-rt/fix-sp"]

Expand Down Expand Up @@ -150,7 +155,7 @@ embassy-generic-queue-64 = ["embassy-time/generic-queue-64"]
embassy-generic-queue-128 = ["embassy-time/generic-queue-128"]

# Architecture-specific features (intended for internal use)
riscv = ["critical-section/restore-state-u8", "esp-riscv-rt", "esp-riscv-rt/zero-bss"]
riscv = ["dep:riscv", "critical-section/restore-state-u8"]
xtensa = ["critical-section/restore-state-u32"]

# Initialize / clear data sections and RTC memory
Expand Down
4 changes: 2 additions & 2 deletions esp-hal-common/src/interrupt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
//! ```
#[cfg(riscv)]
pub use riscv::*;
pub use self::riscv::*;
#[cfg(xtensa)]
pub use xtensa::*;
pub use self::xtensa::*;

#[cfg(riscv)]
mod riscv;
Expand Down
12 changes: 7 additions & 5 deletions esp-hal-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
// MUST be the first module
mod fmt;

#[cfg(riscv)]
#[cfg(feature = "rt-riscv")]
pub use esp_riscv_rt::{self, entry, riscv};
pub use procmacros as macros;
#[cfg(xtensa)]
pub use xtensa_lx;
#[cfg(xtensa)]
#[cfg(feature = "rt-xtensa")]
pub use xtensa_lx_rt::{self, entry};

#[cfg(adc)]
Expand Down Expand Up @@ -104,7 +104,10 @@ pub mod hmac;
pub mod i2c;
#[cfg(any(i2s0, i2s1))]
pub mod i2s;
#[cfg(any(dport, interrupt_core0, interrupt_core1))]
#[cfg(all(
any(dport, interrupt_core0, interrupt_core1),
any(feature = "rt-riscv", feature = "rt-xtensa")
))]
pub mod interrupt;
#[cfg(ledc)]
pub mod ledc;
Expand Down Expand Up @@ -150,6 +153,7 @@ pub mod uart;
pub mod usb_serial_jtag;

/// State of the CPU saved when entering exception or interrupt
#[cfg(any(feature = "rt-riscv", feature = "rt-xtensa"))]
pub mod trapframe {
#[cfg(riscv)]
pub use esp_riscv_rt::TrapFrame;
Expand Down Expand Up @@ -278,8 +282,6 @@ mod critical_section_impl {

#[cfg(riscv)]
mod riscv {
use esp_riscv_rt::riscv;

#[cfg(multi_core)]
// The restore state is a u8 that is casted from a bool, so it has a value of
// 0x00 or 0x01 before we add the reentry flag to it.
Expand Down
4 changes: 3 additions & 1 deletion esp-hal-common/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ pub use crate::dma::{
DmaTransfer as _esp_hal_dma_DmaTransfer,
DmaTransferRxTx as _esp_hal_dma_DmaTransferRxTx,
};
#[cfg(any(feature = "rt-riscv", feature = "rt-xtensa"))]
pub use crate::entry;
#[cfg(gpio)]
pub use crate::gpio::{
InputPin as _esp_hal_gpio_InputPin,
Expand All @@ -59,4 +61,4 @@ pub use crate::timer::{
};
#[cfg(any(uart0, uart1, uart2))]
pub use crate::uart::{Instance as _esp_hal_uart_Instance, UartPins as _esp_hal_uart_UartPins};
pub use crate::{clock::Clock as _esp_hal_clock_Clock, entry, macros::*};
pub use crate::{clock::Clock as _esp_hal_clock_Clock, macros::*};
8 changes: 4 additions & 4 deletions esp-hal-common/src/soc/esp32/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,18 +683,18 @@ pub(crate) fn errata36(pin_num: u8, pull_up: bool, pull_down: bool) {
32 => {
rtcio.xtal_32k_pad().modify(|r, w| unsafe {
w.bits(r.bits())
.x32n_rue()
.x32p_rue()
.bit(pull_up)
.x32n_rde()
.x32p_rde()
.bit(pull_down)
});
}
33 => {
rtcio.xtal_32k_pad().modify(|r, w| unsafe {
w.bits(r.bits())
.x32p_rue()
.x32n_rue()
.bit(pull_up)
.x32p_rde()
.x32n_rde()
.bit(pull_down)
});
}
Expand Down
2 changes: 1 addition & 1 deletion esp32-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ debug = ["esp-hal-common/debug"]
defmt = ["esp-hal-common/defmt", "esp-println/defmt"]
eh1 = ["esp-hal-common/eh1"]
log = ["esp-hal-common/log", "esp-println/log"]
rt = []
rt = ["esp-hal-common/rt-xtensa"]
ufmt = ["esp-hal-common/ufmt"]
vectored = ["esp-hal-common/vectored"]
xtal-26mhz = ["esp-hal-common/xtal-26mhz"]
Expand Down
2 changes: 1 addition & 1 deletion esp32c2-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ direct-vectoring = ["esp-hal-common/direct-vectoring"]
eh1 = ["esp-hal-common/eh1"]
interrupt-preemption = ["esp-hal-common/interrupt-preemption"]
log = ["esp-hal-common/log", "esp-println/log"]
rt = []
rt = ["esp-hal-common/rt-riscv"]
ufmt = ["esp-hal-common/ufmt"]
vectored = ["esp-hal-common/vectored"]
xtal-26mhz = ["esp-hal-common/xtal-26mhz"]
Expand Down
2 changes: 1 addition & 1 deletion esp32c3-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ direct-vectoring = ["esp-hal-common/direct-vectoring"]
eh1 = ["esp-hal-common/eh1"]
interrupt-preemption = ["esp-hal-common/interrupt-preemption"]
log = ["esp-hal-common/log", "esp-println/log"]
rt = []
rt = ["esp-hal-common/rt-riscv"]
ufmt = ["esp-hal-common/ufmt"]
vectored = ["esp-hal-common/vectored"]

Expand Down
2 changes: 1 addition & 1 deletion esp32c6-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ direct-vectoring = ["esp-hal-common/direct-vectoring"]
eh1 = ["esp-hal-common/eh1"]
interrupt-preemption = ["esp-hal-common/interrupt-preemption"]
log = ["esp-hal-common/log", "esp-println/log"]
rt = []
rt = ["esp-hal-common/rt-riscv"]
ufmt = ["esp-hal-common/ufmt"]
vectored = ["esp-hal-common/vectored"]
flip-link = ["esp-hal-common/flip-link"]
Expand Down
2 changes: 1 addition & 1 deletion esp32h2-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ direct-vectoring = ["esp-hal-common/direct-vectoring"]
eh1 = ["esp-hal-common/eh1"]
interrupt-preemption = ["esp-hal-common/interrupt-preemption"]
log = ["esp-hal-common/log", "esp-println/log"]
rt = []
rt = ["esp-hal-common/rt-riscv"]
ufmt = ["esp-hal-common/ufmt"]
vectored = ["esp-hal-common/vectored"]
flip-link = ["esp-hal-common/flip-link"]
Expand Down
2 changes: 1 addition & 1 deletion esp32s2-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ debug = ["esp-hal-common/debug"]
defmt = ["esp-hal-common/defmt", "esp-println/defmt"]
eh1 = ["esp-hal-common/eh1"]
log = ["esp-hal-common/log", "esp-println/log"]
rt = []
rt = ["esp-hal-common/rt-xtensa"]
ufmt = ["esp-hal-common/ufmt"]
vectored = ["esp-hal-common/vectored"]

Expand Down
2 changes: 1 addition & 1 deletion esp32s3-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ debug = ["esp-hal-common/debug"]
defmt = ["esp-hal-common/defmt", "esp-println/defmt"]
eh1 = ["esp-hal-common/eh1"]
log = ["esp-hal-common/log", "esp-println/log"]
rt = []
rt = ["esp-hal-common/rt-xtensa"]
ufmt = ["esp-hal-common/ufmt"]
vectored = ["esp-hal-common/vectored"]

Expand Down

0 comments on commit a3ebd3f

Please sign in to comment.