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

Added support for ESP32-H2 #29

Merged
merged 2 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ jobs:
strategy:
fail-fast: false
matrix:
chip: [esp32c2, esp32c3, esp32c6]
chip: [esp32c2, esp32c3, esp32c6, esp32h2]
printer: ["print-rtt", "print-uart"]
include:
- chip: esp32c3
printer: "print-jtag-serial"
- chip: esp32c6
printer: "print-jtag-serial"
- chip: esp32h2
printer: "print-jtag-serial"
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@v1
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ esp32c3 = ["esp-println?/esp32c3"]
esp32c6 = ["esp-println?/esp32c6"]
esp32s2 = ["esp-println?/esp32s2"]
esp32s3 = ["esp-println?/esp32s3"]
esp32h2 = ["esp-println?/esp32h2"]

# You must enable exactly one of the below features to enable the intended
# communication method:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# esp-backtrace - backtrace for ESP32 bare-metal

Supports the ESP32, ESP32-C2/C3/C6, and ESP32-S2/S3. Optional exception and panic handlers are included, both of which can be enabled via their respective features.
Supports the ESP32, ESP32-C2/C3/C6, ESP32-S2/S3 and ESP32H2. Optional exception and panic handlers are included, both of which can be enabled via their respective features.

Please note that you **need** to force frame pointers (i.e. `"-C", "force-frame-pointers",` in your `.cargo/config.toml`)

Expand All @@ -22,6 +22,7 @@ When using this together with `esp-println` make sure to use the same output kin
| esp32c6 | Target ESP32-C6 |
| esp32s2 | Target ESP32-S2 |
| esp32s3 | Target ESP32-S3 |
| esp32h2 | Target ESP32-H2 |
| panic-handler | Include a panic handler, will add `esp-println` as a dependency |
| exception-handler | Include an exception handler, will add `esp-println` as a dependency |
| print-uart | Use UART to print messages\* |
Expand Down
5 changes: 3 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ fn main() {
cfg!(feature = "esp32c6"),
cfg!(feature = "esp32s2"),
cfg!(feature = "esp32s3"),
cfg!(feature = "esp32h2"),
];

match chip_features.iter().filter(|&&f| f).count() {
Expand All @@ -32,10 +33,10 @@ fn main() {
// enabled, either the `esp32c3`, `esp32c6`, or `esp32s3` chip feature is
// enabled.
if cfg!(feature = "print-jtag-serial")
&& !(cfg!(feature = "esp32c3") || cfg!(feature = "esp32c6") || cfg!(feature = "esp32s3"))
&& !(cfg!(feature = "esp32c3") || cfg!(feature = "esp32c6") || cfg!(feature = "esp32s3") || cfg!(feature = "esp32h2"))
{
panic!(
"The `print-jtag-serial` feature is only supported by the ESP32-C3, ESP32-C6, and ESP32-S3"
"The `print-jtag-serial` feature is only supported by the ESP32-C3, ESP32-C6, ESP32-S3 and ESP32-H2 chips"
);
}
}
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ fn is_valid_ram_address(address: u32) -> bool {
return false;
}

#[cfg(feature = "esp32h2")]
if !(0x4080_0000..=0x4085_0000).contains(&address) {
return false;
}

true
}

Expand Down