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

Fix RiscV installation/uninstallation #107

Merged
merged 27 commits into from
Dec 23, 2022
Merged

Fix RiscV installation/uninstallation #107

merged 27 commits into from
Dec 23, 2022

Conversation

SergioGasquez
Copy link
Member

  • RiscV Rust target was only installed when installing ESP32C3. Now its also installed with ESP32C2
  • Fix espup uninstall when several RiscV targets were installed. See uninstall command fails when using multiple RiscV targets #106 for more details
  • RiscV Rust targets were not being deleted during uninstall command, now they are if a RiscV target is installed.

Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, but left a few comments. Feel free to ignore them 😁

src/toolchain/rust.rs Outdated Show resolved Hide resolved
src/toolchain/rust.rs Show resolved Hide resolved
@@ -189,7 +190,7 @@ fn install(args: InstallOpts) -> Result<()> {

exports.extend(llvm.install()?);

if targets.contains(&Target::ESP32C3) {
if targets.contains(&Target::ESP32C3) || targets.contains(&Target::ESP32C2) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a nicer way of handling this (which could be done in a separate PR) would be to implement some helpers on Target to determine the architecture. As we continue to add support for addition devices we're going to keep needing to chain expressions with || here.

Maybe if we do something like this:

impl Target {
    pub fn riscv(&self) -> bool {
        !self.xtensa()
    }

    pub fn xtensa(&self) -> bool {
        matches!(self, Target::Esp32 | Target::Esp32s2 | Target::Esp32s3)
    }
}

We can then change this line (and the others like it) to something like this:

if targets.iter().any(|t| t.riscv()) {
    //
}

Just a thought, doesn't really matter right now but will likely clean things up in the future. If you don't like this idea then that is fine of course too 😁

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the idea! It would definitely things scale better! I will address this on a different PR though. I also plan to install RISC-V GCC toolchain (riscv32-esp-elf) for ESP32-S2 and ESP32-S3 for the ULP coprocessor.

@SergioGasquez SergioGasquez merged commit 736627d into esp-rs:main Dec 23, 2022
@SergioGasquez SergioGasquez deleted the fix/riscv-uninstall branch December 23, 2022 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uninstall command fails when using multiple RiscV targets
2 participants