Use stable toolchain for RISC-V devices (#487)

* feat: Use stable toolchain

* docs: Update changelog
This commit is contained in:
Sergio Gasquez Arcos 2025-04-04 11:00:58 +02:00 committed by GitHub
parent f2b35ce414
commit 609424f729
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 27 additions and 22 deletions

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
### Changed ### Changed
- Install `stable` Rust toolchain instead of `nightly` for RISC-V devices (#487)
### Removed ### Removed

View File

@ -161,10 +161,12 @@ Options:
[default: esp] [default: esp]
-n, --nightly-version <NIGHTLY_VERSION> -b, --stable-version <STABLE_VERSION>
Nightly Rust toolchain version Stable Rust toolchain version.
[default: nightly] Note that only RISC-V targets use stable Rust channel.
[default: stable]
-k, --skip-version-parse -k, --skip-version-parse
Skips parsing Xtensa Rust version Skips parsing Xtensa Rust version
@ -229,10 +231,12 @@ Options:
[default: esp] [default: esp]
-n, --nightly-version <NIGHTLY_VERSION> -b, --stable-version <STABLE_VERSION>
Nightly Rust toolchain version Stable Rust toolchain version.
[default: nightly] Note that only RISC-V targets use stable Rust channel.
[default: stable]
-k, --skip-version-parse -k, --skip-version-parse
Skips parsing Xtensa Rust version Skips parsing Xtensa Rust version

View File

@ -38,11 +38,11 @@ pub struct InstallOpts {
/// Xtensa Rust toolchain name. /// Xtensa Rust toolchain name.
#[arg(short = 'a', long, default_value = "esp")] #[arg(short = 'a', long, default_value = "esp")]
pub name: String, pub name: String,
/// Nightly Rust toolchain version. /// Stable Rust toolchain version.
/// ///
/// Note that only RISC-V targets use nightly Rust channel. /// Note that only RISC-V targets use stable Rust channel.
#[arg(short = 'n', long, default_value = "nightly")] #[arg(short = 'b', long, default_value = "stable")]
pub nightly_version: String, pub stable_version: String,
/// Skips parsing Xtensa Rust version. /// Skips parsing Xtensa Rust version.
#[arg(short = 'k', long, requires = "toolchain_version")] #[arg(short = 'k', long, requires = "toolchain_version")]
pub skip_version_parse: bool, pub skip_version_parse: bool,

View File

@ -268,7 +268,7 @@ pub async fn install(args: InstallOpts, install_mode: InstallMode) -> Result<()>
- Export file: {:?} - Export file: {:?}
- Host triple: {} - Host triple: {}
- LLVM Toolchain: {:?} - LLVM Toolchain: {:?}
- Nightly version: {:?} - Stable version: {:?}
- Rust Toolchain: {:?} - Rust Toolchain: {:?}
- Skip version parsing: {} - Skip version parsing: {}
- Targets: {:?} - Targets: {:?}
@ -277,7 +277,7 @@ pub async fn install(args: InstallOpts, install_mode: InstallMode) -> Result<()>
&export_file, &export_file,
host_triple, host_triple,
&llvm, &llvm,
&args.nightly_version, &args.stable_version,
xtensa_rust, xtensa_rust,
&args.skip_version_parse, &args.skip_version_parse,
targets, targets,
@ -301,7 +301,7 @@ pub async fn install(args: InstallOpts, install_mode: InstallMode) -> Result<()>
} }
if targets.iter().any(|t| t.is_riscv()) { if targets.iter().any(|t| t.is_riscv()) {
let riscv_target = RiscVTarget::new(&args.nightly_version); let riscv_target = RiscVTarget::new(&args.stable_version);
to_install.push(Box::new(riscv_target)); to_install.push(Box::new(riscv_target));
} }

View File

@ -319,20 +319,20 @@ impl Installable for XtensaRust {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct RiscVTarget { pub struct RiscVTarget {
/// Nightly version. /// Stable Rust toolchain version.
pub nightly_version: String, pub stable_version: String,
} }
impl RiscVTarget { impl RiscVTarget {
/// Create a crate instance. /// Create a crate instance.
pub fn new(nightly_version: &str) -> Self { pub fn new(stable_version: &str) -> Self {
RiscVTarget { RiscVTarget {
nightly_version: nightly_version.to_string(), stable_version: stable_version.to_string(),
} }
} }
/// Uninstalls the RISC-V target. /// Uninstalls the RISC-V target.
pub fn uninstall(nightly_version: &str) -> Result<(), Error> { pub fn uninstall(stable_version: &str) -> Result<(), Error> {
info!("Uninstalling RISC-V target"); info!("Uninstalling RISC-V target");
if !Command::new("rustup") if !Command::new("rustup")
@ -340,7 +340,7 @@ impl RiscVTarget {
"target", "target",
"remove", "remove",
"--toolchain", "--toolchain",
nightly_version, stable_version,
"riscv32imc-unknown-none-elf", "riscv32imc-unknown-none-elf",
"riscv32imac-unknown-none-elf", "riscv32imac-unknown-none-elf",
"riscv32imafc-unknown-none-elf", "riscv32imafc-unknown-none-elf",
@ -359,14 +359,14 @@ impl RiscVTarget {
impl Installable for RiscVTarget { impl Installable for RiscVTarget {
async fn install(&self) -> Result<Vec<String>, Error> { async fn install(&self) -> Result<Vec<String>, Error> {
info!( info!(
"Installing RISC-V Rust targets ('riscv32imc-unknown-none-elf', 'riscv32imac-unknown-none-elf' and 'riscv32imafc-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.stable_version
); );
if !Command::new("rustup") if !Command::new("rustup")
.args([ .args([
"toolchain", "toolchain",
"install", "install",
&self.nightly_version, &self.stable_version,
"--profile", "--profile",
"minimal", "minimal",
"--component", "--component",
@ -383,7 +383,7 @@ impl Installable for RiscVTarget {
.status()? .status()?
.success() .success()
{ {
return Err(Error::InstallRiscvTarget(self.nightly_version.clone())); return Err(Error::InstallRiscvTarget(self.stable_version.clone()));
} }
Ok(vec![]) // No exports Ok(vec![]) // No exports