Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 9 commits into from
Nov 8, 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
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