Update flake.nix and README.md for Raspberry Pi Pico W support
This commit is contained in:
@@ -19,7 +19,7 @@ direnv allow
|
|||||||
When you enter the devShell (via `direnv allow` or `nix develop`), the following happens automatically:
|
When you enter the devShell (via `direnv allow` or `nix develop`), the following happens automatically:
|
||||||
|
|
||||||
✓ **Git Repository**: Initializes `.git` if not present
|
✓ **Git Repository**: Initializes `.git` if not present
|
||||||
✓ **Rust Targets**: Automatically adds common embedded Rust targets (ARM Cortex-M, RISC-V)
|
✓ **Rust Targets**: Automatically adds the RP2040 (Pico W) target: `thumbv6m-none-eabi`
|
||||||
✓ **Cargo Paths**: Sets up `$HOME/.cargo/bin` in PATH for cargo-installed binaries
|
✓ **Cargo Paths**: Sets up `$HOME/.cargo/bin` in PATH for cargo-installed binaries
|
||||||
✓ **Welcome Banner**: Displays available tools and quick commands
|
✓ **Welcome Banner**: Displays available tools and quick commands
|
||||||
|
|
||||||
@@ -35,16 +35,11 @@ cargo build
|
|||||||
|
|
||||||
## Embedded Rust Support
|
## Embedded Rust Support
|
||||||
|
|
||||||
The devShell automatically installs common embedded Rust targets via `rustup`:
|
The devShell automatically installs the Raspberry Pi Pico W target via `rustup`:
|
||||||
|
|
||||||
| Target | Platform | Use Case |
|
| Target | Platform | Use Case |
|
||||||
|--------|----------|----------|
|
|--------|----------|----------|
|
||||||
| `thumbv6m-none-eabi` | ARM Cortex-M0/M0+ | RP2040 (Pico) |
|
| `thumbv6m-none-eabi` | ARM Cortex-M0/M0+ | RP2040 (Pico W) |
|
||||||
| `thumbv7em-none-eabihf` | ARM Cortex-M4F/M7F | STM32, nRF52840 |
|
|
||||||
| `riscv32imc-unknown-none-elf` | RISC-V 32-bit | ESP32-C3 (basic) |
|
|
||||||
| `riscv32imac-unknown-none-elf` | RISC-V 32-bit (atomic) | ESP32-C3 (advanced) |
|
|
||||||
|
|
||||||
**Note:** ESP32 Xtensa targets require espup or custom toolchains (see [esp-rs](https://github.com/esp-rs)).
|
|
||||||
|
|
||||||
## Flatpak Packaging
|
## Flatpak Packaging
|
||||||
|
|
||||||
@@ -84,14 +79,11 @@ flatpak run org.example.rustdevshell
|
|||||||
| **rustfmt** | Rust code formatter |
|
| **rustfmt** | Rust code formatter |
|
||||||
| **rust-analyzer** | Language server for IDE integration |
|
| **rust-analyzer** | Language server for IDE integration |
|
||||||
| **rust-src** | Rust source code (for tools like rust-analyzer) |
|
| **rust-src** | Rust source code (for tools like rust-analyzer) |
|
||||||
| **probe-rs** | Embedded debugger/flasher for ARM targets |
|
| **probe-rs** | Embedded debugger/flasher |
|
||||||
| **espflash** | Flashing tool for ESP32 boards |
|
| **openocd** | JTAG/SWD debugger |
|
||||||
| **openocd** | JTAG/SWD debugger for ARM and other targets |
|
|
||||||
| **minicom** | Serial terminal for device output |
|
| **minicom** | Serial terminal for device output |
|
||||||
| **elf2uf2-rs** | Convert ELF to UF2 format (RP2040) |
|
| **elf2uf2-rs** | Convert ELF to UF2 format (RP2040) |
|
||||||
| **picotool** | Pico-specific firmware operations |
|
| **picotool** | Pico-specific firmware operations |
|
||||||
| **avrdude** | AVR microcontroller programmer |
|
|
||||||
| **ravedude** | Rapid AVR development utility |
|
|
||||||
|
|
||||||
## Testing & Development Features
|
## Testing & Development Features
|
||||||
|
|
||||||
@@ -114,7 +106,7 @@ cargo clippy
|
|||||||
cargo fmt
|
cargo fmt
|
||||||
|
|
||||||
# Build for embedded target
|
# Build for embedded target
|
||||||
cargo build --target thumbv7em-none-eabihf --release
|
cargo build --target thumbv6m-none-eabi --release
|
||||||
```
|
```
|
||||||
|
|
||||||
## Project Layout
|
## Project Layout
|
||||||
|
|||||||
@@ -73,16 +73,11 @@
|
|||||||
rustup
|
rustup
|
||||||
# Embedded Rust tooling
|
# Embedded Rust tooling
|
||||||
probe-rs-tools
|
probe-rs-tools
|
||||||
espflash
|
|
||||||
openocd
|
openocd
|
||||||
minicom
|
minicom
|
||||||
# RP2040 UF2 workflows
|
# RP2040 UF2 workflows
|
||||||
elf2uf2-rs
|
elf2uf2-rs
|
||||||
picotool
|
picotool
|
||||||
avrdude
|
|
||||||
pkgsCross.avr.buildPackages.libc
|
|
||||||
pkgsCross.avr.buildPackages.gcc
|
|
||||||
ravedude
|
|
||||||
pre-commit
|
pre-commit
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -102,15 +97,11 @@
|
|||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
|
|
||||||
if command -v rustup >/dev/null 2>&1; then
|
if command -v rustup >/dev/null 2>&1; then
|
||||||
echo "Ensuring common embedded Rust targets are available (idempotent)..."
|
echo "Ensuring Raspberry Pi Pico W target is available (idempotent)..."
|
||||||
rustup target add thumbv6m-none-eabi >/dev/null 2>&1 || true # Cortex-M0/M0+ (RP2040)
|
rustup target add thumbv6m-none-eabi >/dev/null 2>&1 || true # Cortex-M0/M0+ (RP2040)
|
||||||
rustup target add thumbv7em-none-eabihf >/dev/null 2>&1 || true # Cortex-M4F/M7F (many STM32/nRF52)
|
|
||||||
rustup target add riscv32imc-unknown-none-elf >/dev/null 2>&1 || true
|
|
||||||
rustup target add riscv32imac-unknown-none-elf >/dev/null 2>&1 || true # ESP32-C3 class
|
|
||||||
echo "Note: ESP32 Xtensa targets require espup/custom toolchains (see esp-rs)."
|
|
||||||
fi
|
fi
|
||||||
echo "[rust-template] Welcome to the Rust dev shell!"
|
echo "[rust-template] Welcome to the Rust dev shell!"
|
||||||
echo "Tools: cargo, rustc, clippy, rustfmt, rust-analyzer, probe-rs, espflash, openocd, minicom, elf2uf2-rs, picotool, avrdude, ravedude"
|
echo "Tools: cargo, rustc, clippy, rustfmt, rust-analyzer, probe-rs, openocd, minicom, elf2uf2-rs, picotool"
|
||||||
echo "Run 'cargo build' to build, or 'nix run .#dev-helper' for a tool summary."
|
echo "Run 'cargo build' to build, or 'nix run .#dev-helper' for a tool summary."
|
||||||
echo "See README.md for usage."
|
echo "See README.md for usage."
|
||||||
'';
|
'';
|
||||||
|
|||||||
Reference in New Issue
Block a user