Update flake.nix to use latest Rust toolchain
This commit is contained in:
+7
-1
@@ -1,5 +1,11 @@
|
||||
[target.thumbv6m-none-eabi]
|
||||
runner = "direnv exec . probe-rs run --chip RP2040"
|
||||
runner = "direnv exec . elf2uf2-rs -d"
|
||||
rustflags = [
|
||||
"-C", "linker=rust-lld",
|
||||
"-C", "link-arg=-Tlink.x",
|
||||
"-C", "link-arg=-Tlink-rp.x",
|
||||
"-C", "link-arg=-Tdefmt.x",
|
||||
]
|
||||
|
||||
[build]
|
||||
target = "thumbv6m-none-eabi"
|
||||
|
||||
@@ -104,22 +104,32 @@ flatpak run org.example.rustdevshell
|
||||
|
||||
This project is configured for seamless flashing from the IDE or terminal.
|
||||
|
||||
### Troubleshooting: No Connected Probes
|
||||
### Flashing via USB (BOOTSEL mode)
|
||||
|
||||
If you encounter the error `Error: No connected probes were found` or udev rule warnings, check the following:
|
||||
If you don't have a physical debugger, you can flash the Pico W directly via USB using the BOOTSEL mode:
|
||||
|
||||
1. **Hardware Connection**: Ensure your Raspberry Pi Pico W is connected via a compatible debugger (e.g., another Pico running `picoprobe`, a CMSIS-DAP debugger, or an ESP-Prog).
|
||||
2. **Udev Rules (Linux)**: `probe-rs` needs permission to access the USB device.
|
||||
- Create a file named `/etc/udev/rules.d/69-probe-rs.rules`.
|
||||
- Add the rules provided by the [probe-rs documentation](https://probe.rs/docs/getting-started/probe-setup/).
|
||||
1. **Enter BOOTSEL Mode**: Hold the `BOOTSEL` button on your Pico W while plugging it into your computer's USB port. It should appear as a USB mass storage device.
|
||||
2. **Flash and Run**: Run the following command (or use the IDE "Run" button):
|
||||
```bash
|
||||
cargo run --release
|
||||
```
|
||||
This project is configured to use `elf2uf2-rs`, which automatically detects the Pico W in BOOTSEL mode, converts the binary to UF2 format, and flashes it.
|
||||
|
||||
### Troubleshooting: Flashing Issues
|
||||
|
||||
If you encounter issues flashing via USB:
|
||||
1. **Check BOOTSEL mode**: Ensure the Pico W is mounted as a USB drive.
|
||||
2. **Udev Rules (Linux)**: You may need permissions to access the USB device.
|
||||
- Create a file named `/etc/udev/rules.d/99-pico.rules`.
|
||||
- Add: `SUBSYSTEMS=="usb", ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="0003", MODE="0666"`
|
||||
- Reload rules: `sudo udevadm control --reload` and `sudo udevadm trigger`.
|
||||
3. **Group Membership**: Ensure your user is in the `plugdev` or `dialout` group (depending on your distro's udev rules).
|
||||
3. **Cable**: Ensure you are using a data-sync USB cable, not just a charging cable.
|
||||
|
||||
### Flashing from IDE
|
||||
|
||||
If you are using **RustRover** or **IntelliJ Rust**, you can use the "Flash Pico W" run configuration provided in the `.run` folder. Just select it from the run menu and click "Run".
|
||||
|
||||
**Note:** The project is configured to use `direnv exec .` in `.cargo/config.toml` to ensure `probe-rs` is available. Ensure `direnv` is installed and allowed (`direnv allow`) on your system. For the best experience, we recommend installing the **direnv** plugin for your IDE.
|
||||
**Note:** The project is configured to use `direnv exec .` in `.cargo/config.toml` to ensure `elf2uf2-rs` is available. Ensure `direnv` is installed and allowed (`direnv allow`) on your system. For the best experience, we recommend installing the **direnv** plugin for your IDE.
|
||||
|
||||
### Flashing from Terminal
|
||||
|
||||
@@ -129,10 +139,10 @@ You can flash the Pico W by running:
|
||||
cargo run --release
|
||||
```
|
||||
|
||||
This uses `probe-rs` (configured in `.cargo/config.toml`) to flash and run the binary via a CMSIS-DAP debugger or similar.
|
||||
This uses `elf2uf2-rs` (configured in `.cargo/config.toml`) to flash the binary via the USB BOOTSEL mode.
|
||||
|
||||
If you prefer to use the UF2 bootloader (dragging to the drive or using `elf2uf2-rs`), you can change the runner in `.cargo/config.toml` to:
|
||||
`runner = "elf2uf2-rs -d"`
|
||||
If you prefer to use a physical debugger (e.g. CMSIS-DAP), you can change the runner in `.cargo/config.toml` to:
|
||||
`runner = "direnv exec . probe-rs run --chip RP2040"`
|
||||
|
||||
## Testing & Development Features
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
MEMORY
|
||||
{
|
||||
/* FLASH and RAM lengths must match the RP2040 */
|
||||
BOOT2 : ORIGIN = 0x10000000, LENGTH = 0x100
|
||||
FLASH : ORIGIN = 0x10000100, LENGTH = 2048K - 0x100
|
||||
RAM : ORIGIN = 0x20000000, LENGTH = 256K
|
||||
SCRATCH_A : ORIGIN = 0x20040000, LENGTH = 4K
|
||||
SCRATCH_B : ORIGIN = 0x20041000, LENGTH = 4K
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
use defmt_rtt as _;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp as _;
|
||||
use panic_probe as _;
|
||||
|
||||
#[embassy_executor::main]
|
||||
|
||||
Reference in New Issue
Block a user