Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #15 from jessebraham/feature/chip-support
Browse files Browse the repository at this point in the history
Add support for the ESP32-C6
  • Loading branch information
bjoernQ authored Nov 7, 2022
2 parents 869afb2 + a175463 commit 05096d6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ default = ["uart"]
esp32 = []
esp32c2 = []
esp32c3 = []
esp32c6 = []
esp32s2 = []
esp32s3 = []
esp8266 = []

# You must enable exactly 1 of the below features to enable to intended
# communication method (note that "uart" is enabled by default):
uart = []
jtag_serial = [] # C3 + S3 only!
jtag_serial = [] # C3, C6, and S3 only!
rtt = []
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Provides `print!` and `println!` implementations various Espressif devices.

- Supports ESP32, ESP32-C2, ESP32-C3, ESP32-S2, ESP32-S3, and ESP8266
- Supports ESP32, ESP32-C2, ESP32-C3, ESP32-C6, ESP32-S2, ESP32-S3, and ESP8266
- Dependency free (not even depending on `esp-hal`, one optional dependency is `log`, another is `critical-section`)
- Supports JTAG-Serial output where available
- Supports RTT (lacking working RTT hosts besides _probe-rs_ for ESP32-C3)
Expand Down
13 changes: 9 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ fn main() {
cfg!(feature = "esp32"),
cfg!(feature = "esp32c2"),
cfg!(feature = "esp32c3"),
cfg!(feature = "esp32c6"),
cfg!(feature = "esp32s2"),
cfg!(feature = "esp32s3"),
cfg!(feature = "esp8266"),
Expand All @@ -28,9 +29,13 @@ fn main() {
),
}

// Ensure that, if the `jtag_serial` communication method feature is
// enabled, either the `esp32c3` or `esp32s3` chip feature is enabled.
if cfg!(feature = "jtag_serial") && !(cfg!(feature = "esp32c3") || cfg!(feature = "esp32s3")) {
panic!("The `jtag_serial` feature is only supported by the ESP32-C3 and ESP32-S3");
// Ensure that, if the `jtag_serial` communication method feature is enabled,
// either the `esp32c3`, `esp32c6` or `esp32s3` chip feature is enabled.
if cfg!(feature = "jtag_serial")
&& !(cfg!(feature = "esp32c3") || cfg!(feature = "esp32c6") || cfg!(feature = "esp32s3"))
{
panic!(
"The `jtag_serial` feature is only supported by the ESP32-C3, ESP32-C6, and ESP32-S3"
);
}
}
12 changes: 10 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub mod logger;

#[cfg(feature = "esp32")]
const UART_TX_ONE_CHAR: usize = 0x40009200;
#[cfg(feature = "esp32c2")]
#[cfg(any(feature = "esp32c2", feature = "esp32c6"))]
const UART_TX_ONE_CHAR: usize = 0x40000058;
#[cfg(feature = "esp32c3")]
const UART_TX_ONE_CHAR: usize = 0x40000068;
Expand Down Expand Up @@ -81,12 +81,20 @@ const SERIAL_JTAG_FIFO_REG: usize = 0x6004_3000;
#[cfg(all(feature = "jtag_serial", feature = "esp32c3"))]
const SERIAL_JTAG_CONF_REG: usize = 0x6004_3004;

#[cfg(all(feature = "jtag_serial", feature = "esp32c6"))]
const SERIAL_JTAG_FIFO_REG: usize = 0x6000_F000;
#[cfg(all(feature = "jtag_serial", feature = "esp32c6"))]
const SERIAL_JTAG_CONF_REG: usize = 0x6000_F004;

#[cfg(all(feature = "jtag_serial", feature = "esp32s3"))]
const SERIAL_JTAG_FIFO_REG: usize = 0x6003_8000;
#[cfg(all(feature = "jtag_serial", feature = "esp32s3"))]
const SERIAL_JTAG_CONF_REG: usize = 0x6003_8004;

#[cfg(all(feature = "jtag_serial", any(feature = "esp32c3", feature = "esp32s3")))]
#[cfg(all(
feature = "jtag_serial",
any(feature = "esp32c3", feature = "esp32c6", feature = "esp32s3")
))]
impl core::fmt::Write for Printer {
fn write_str(&mut self, s: &str) -> core::fmt::Result {
with(|| {
Expand Down

0 comments on commit 05096d6

Please sign in to comment.