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
### Changed
- Install `stable` Rust toolchain instead of `nightly` for RISC-V devices (#487)
### Removed

View File

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

View File

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

View File

@ -268,7 +268,7 @@ pub async fn install(args: InstallOpts, install_mode: InstallMode) -> Result<()>
- Export file: {:?}
- Host triple: {}
- LLVM Toolchain: {:?}
- Nightly version: {:?}
- Stable version: {:?}
- Rust Toolchain: {:?}
- Skip version parsing: {}
- Targets: {:?}
@ -277,7 +277,7 @@ pub async fn install(args: InstallOpts, install_mode: InstallMode) -> Result<()>
&export_file,
host_triple,
&llvm,
&args.nightly_version,
&args.stable_version,
xtensa_rust,
&args.skip_version_parse,
targets,
@ -301,7 +301,7 @@ pub async fn install(args: InstallOpts, install_mode: InstallMode) -> Result<()>
}
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));
}

View File

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