Skip to content

Commit

Permalink
🚩 add flag to only install riscv if user wants (#391)
Browse files Browse the repository at this point in the history
* 🚩 add flag to only install riscv if user wants

* clippy

* rename flag to esp_riscv_gcc

* update comments

* 📝 update CHANGEL + README

* ✏️ typo

* Update src/cli.rs

Co-authored-by: Sergio Gasquez Arcos <[email protected]>

* Update src/toolchain/mod.rs

Co-authored-by: Sergio Gasquez Arcos <[email protected]>

* alphabetical ordering

---------

Co-authored-by: Sergio Gasquez Arcos <[email protected]>
  • Loading branch information
Vollbrecht and SergioGasquez authored Nov 8, 2023
1 parent 353331d commit 7dc66b0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Added new `--esp-riscv-gcc` flag to install esp-riscv-gcc toolchain instead of the system one (#391)

### Fixed

### Changed
- New Default behavior: install esp-riscv-gcc only if the user explicitly uses the `--esp-riscv-gcc` flag (#391)

### Removed

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ Options:
[possible values: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin]
-r, --esp-riscv-gcc
Install Espressif RISC-V toolchain built with croostool-ng
Only install this if you don't want to use the systems RISC-V toolchain
-f, --export-file <EXPORT_FILE>
Relative or full path for the export file that will be generated. If no path is provided, the file will be generated under home directory (https://docs.rs/dirs/latest/dirs/fn.home_dir.html)
Expand Down
5 changes: 5 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ pub struct InstallOpts {
/// Target triple of the host.
#[arg(short = 'd', long, value_parser = ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu", "x86_64-pc-windows-msvc", "x86_64-pc-windows-gnu" , "x86_64-apple-darwin" , "aarch64-apple-darwin"])]
pub default_host: Option<String>,
/// Install Espressif RISC-V toolchain built with croostool-ng
///
/// Only install this if you don't want to use the systems RISC-V toolchain
#[arg(short = 'r', long)]
pub esp_riscv_gcc: bool,
/// Relative or full path for the export file that will be generated. If no path is provided, the file will be generated under home directory (https://docs.rs/dirs/latest/dirs/fn.home_dir.html).
#[arg(short = 'f', long)]
pub export_file: Option<PathBuf>,
Expand Down
6 changes: 3 additions & 3 deletions src/toolchain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ pub async fn install(args: InstallOpts, install_mode: InstallMode) -> Result<()>
let xtensa_gcc = Gcc::new(XTENSA_GCC, &host_triple, &toolchain_dir);
to_install.push(Box::new(xtensa_gcc));
}
// All RISC-V targets use the same GCC toolchain
// ESP32S2 and ESP32S3 also install the RISC-V toolchain for their ULP coprocessor
if targets.iter().any(|t| t != &Target::ESP32) {

// By default only install the Espressif RISC-V toolchain if the user explicitly wants to
if args.esp_riscv_gcc && targets.iter().any(|t| t != &Target::ESP32) {
let riscv_gcc = Gcc::new(RISCV_GCC, &host_triple, &toolchain_dir);
to_install.push(Box::new(riscv_gcc));
}
Expand Down

0 comments on commit 7dc66b0

Please sign in to comment.