🚩 add flag to only install riscv if user wants (#391)

* 🚩 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 <sergio.gasquez@gmail.com>

* Update src/toolchain/mod.rs

Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>

* alphabetical ordering

---------

Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>
This commit is contained in:
Frederick Vollbrecht 2023-11-08 16:46:25 +01:00 committed by GitHub
parent 353331d569
commit 7dc66b012e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 3 deletions

View File

@ -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

View File

@ -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)

View File

@ -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>,

View File

@ -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));
}