Skip to content

Commit

Permalink
Add support for the esp32p4 (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
MabezDev authored Jan 9, 2024
1 parent 7526ba9 commit 6a78401
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 7 additions & 0 deletions build/native/cargo_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,13 @@ pub fn build() -> Result<EspIdfBuildOutput> {
cmake_config.target("riscv32imc_zicsr_zifencei-esp-espidf");
} else if target == "riscv32imac-esp-espidf" {
cmake_config.target("riscv32imac_zicsr_zifencei-esp-espidf");
} else if target == "riscv32imafc-esp-espidf" {
cmake_config.target("riscv32imafc_zicsr_zifencei-esp-espidf");
// workaround for a bug in cc-rs
// see https://github.com/rust-lang/cc-rs/issues/795 & https://github.com/rust-lang/cc-rs/pull/796
cmake_config.cflag("-mabi=ilp32f");
} else {
panic!("Unsupported target: {}", target);
}
}

Expand Down
5 changes: 2 additions & 3 deletions build/native/cargo_driver/chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ impl Chip {
"xtensa-esp32s2-espidf" => &[Chip::ESP32S2],
"xtensa-esp32s3-espidf" => &[Chip::ESP32S3],
"riscv32imc-esp-espidf" => &[Chip::ESP32C3, Chip::ESP32C2], // Keep C3 as the first in the list, so it is picked up by default; as C2 does not work for older ESP IDFs
"riscv32imac-esp-espidf" => {
&[Chip::ESP32H2, Chip::ESP32C5, Chip::ESP32C6, Chip::ESP32P4]
}
"riscv32imac-esp-espidf" => &[Chip::ESP32H2, Chip::ESP32C5, Chip::ESP32C6],
"riscv32imafc-esp-espidf" => &[Chip::ESP32P4],
_ => bail!("Unsupported target '{}'", rust_target_triple),
};

Expand Down
2 changes: 1 addition & 1 deletion src/include/esp-idf/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
#include "driver/i2s.h"
#include "driver/mcpwm.h"
#endif
#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32H2) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32P4)
#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32H2) || defined(CONFIG_IDF_TARGET_ESP32C6) // defined(CONFIG_IDF_TARGET_ESP32P4) // not yet supported in esp-idf
#include "driver/pcnt.h"
#if ESP_IDF_VERSION_MAJOR >= 5
#include "driver/pulse_cnt.h"
Expand Down

0 comments on commit 6a78401

Please sign in to comment.