function check_rustup { if type rustup >/dev/null; then rustup --version echo "rustup is installed!" return 0 else echo "rustup not found" echo "starting to install rustup.." curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh return 4 fi } check_rustup echo "updateing rustup.." rustup update echo "installing llvm-tools.." rustup component add llvm-tools rustup component add rustfmt rustup default stable rustup update stable echo "adding some popular toolchains.." rustup target add thumbv6m-none-eabi # Cortex-M0 and Cortex-M0+ rustup target add thumbv7m-none-eabi # Cortex-M3 rustup target add thumbv7em-none-eabi # Cortex-M4 and Cortex-M7 (no FPU) rustup target add thumbv7em-none-eabihf # Cortex-M4F and Cortex-M7F (with FPU) rustup target add thumbv8m.main-none-eabi # Cortex-M33 and M55 (no FPU) rustup target add thumbv8m.main-none-eabihf # Cortex-M33 and M55 (with FPU) rustup target add riscv32imac-unknown-none-elf # RISC-V 32-bit echo "rustup rustc and cargo is ready to go!" echo "rustc version" rustc --version rustup show