From 13694e0935ac2d2ce9fab686866743a7e5649374 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 28 Dec 2023 10:48:12 +0000 Subject: [PATCH 1/2] feat: Add support for ESP32-P4 --- README.md | 2 +- src/cli.rs | 2 +- src/targets.rs | 3 +++ src/toolchain/mod.rs | 5 ++++- src/toolchain/rust.rs | 4 +++- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d7e9d489..a18a9bef 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,7 @@ Options: With this option, espup will skip GCC installation (it will be handled by esp-idf-sys), hence you won't be able to build no_std applications. -t, --targets - Comma or space separated list of targets [esp32,esp32c2,esp32c3,esp32c6,esp32h2,esp32s2,esp32s3,all] + Comma or space separated list of targets [esp32,esp32c2,esp32c3,esp32c6,esp32h2,esp32s2,esp32s3,esp32p4,all] [default: all] diff --git a/src/cli.rs b/src/cli.rs index 34b69ef3..2a5e4a25 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -51,7 +51,7 @@ pub struct InstallOpts { /// With this option, espup will skip GCC installation (it will be handled by esp-idf-sys), hence you won't be able to build no_std applications. #[arg(short = 's', long)] pub std: bool, - /// Comma or space separated list of targets [esp32,esp32c2,esp32c3,esp32c6,esp32h2,esp32s2,esp32s3,all]. + /// Comma or space separated list of targets [esp32,esp32c2,esp32c3,esp32c6,esp32h2,esp32s2,esp32s3,esp32p4,all]. #[arg(short = 't', long, default_value = "all", value_parser = parse_targets)] pub targets: HashSet, /// Xtensa Rust toolchain version. diff --git a/src/targets.rs b/src/targets.rs index a971e33c..d896f848 100644 --- a/src/targets.rs +++ b/src/targets.rs @@ -23,6 +23,8 @@ pub enum Target { ESP32S2, /// Xtensa LX7 based dual core ESP32S3, + /// RISC-V based dual core + ESP32P4, } impl Target { @@ -90,6 +92,7 @@ mod tests { Target::ESP32H2, Target::ESP32S2, Target::ESP32S3, + Target::ESP32P4, ] .into_iter() .collect(); diff --git a/src/toolchain/mod.rs b/src/toolchain/mod.rs index 5d09f8d6..b0d16af8 100644 --- a/src/toolchain/mod.rs +++ b/src/toolchain/mod.rs @@ -200,7 +200,10 @@ pub async fn install(args: InstallOpts, install_mode: InstallMode) -> Result<()> to_install.push(Box::new(xtensa_rust.to_owned())); } - to_install.push(Box::new(llvm)); + // Check if ther is any Xtensa target + if targets.iter().any(|t| t.is_xtensa()) { + to_install.push(Box::new(llvm.to_owned())); + } if targets.iter().any(|t| t.is_riscv()) { let riscv_target = RiscVTarget::new(&args.nightly_version); diff --git a/src/toolchain/rust.rs b/src/toolchain/rust.rs index 6d8e6a6d..4da3c30e 100644 --- a/src/toolchain/rust.rs +++ b/src/toolchain/rust.rs @@ -335,6 +335,7 @@ impl RiscVTarget { nightly_version, "riscv32imc-unknown-none-elf", "riscv32imac-unknown-none-elf", + "riscv32imafc-unknown-none-elf", ]) .stdout(Stdio::null()) .status()? @@ -350,7 +351,7 @@ impl RiscVTarget { impl Installable for RiscVTarget { async fn install(&self) -> Result, Error> { info!( - "Installing RISC-V Rust targets ('riscv32imc-unknown-none-elf' and 'riscv32imac-unknown-none-elf') for '{}' toolchain", &self.nightly_version + "Installing RISC-V Rust targets ('riscv32imc-unknown-none-elf', 'riscv32imac-unknown-none-elf' and 'riscv32imafc-unknown-none-elf') for '{}' toolchain", &self.nightly_version ); if !Command::new("rustup") @@ -365,6 +366,7 @@ impl Installable for RiscVTarget { "--target", "riscv32imc-unknown-none-elf", "riscv32imac-unknown-none-elf", + "riscv32imafc-unknown-none-elf", ]) .stdout(Stdio::null()) .stderr(Stdio::null()) From 340215e1e1001af645bfa1f5597d319a58641628 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Mon, 15 Jan 2024 08:32:09 +0000 Subject: [PATCH 2/2] docs: Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3af5c9f2..8cd6739d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added support for specifying the location of the export file via `ESPUP_EXPORT_FILE` (#403) +- Added support for ESP32-P4 (#408) ### Fixed