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

WSL support needed, Unable to find mounted pico. #10

Open
HughGrant opened this issue Mar 4, 2022 · 3 comments
Open

WSL support needed, Unable to find mounted pico. #10

HughGrant opened this issue Mar 4, 2022 · 3 comments

Comments

@HughGrant
Copy link

Hi, my dev ENV is setup in WSL2.0, even though my pi pico is correctly showing up in windows, it still give this error in my WSL Ubuntu20.04

Anyway how to quick fix this?

@Cryowatt
Copy link

Here's a workaround you (and anyone else who stumbles across this issue) can use:

Add a shell script runner.sh.

#!/bin/sh
mkdir -p ./target/publish/
elf2uf2-rs $1 ./target/publish/image.uf2

Update runner in .cargo/config.toml file to look like this:

[target.thumbv6m-none-eabi]
# ...
runner = "./runner.sh"

When you run cargo run it will run elf2uf2-rs to package and publish the uf2 file to the target/publish/ path. This doesn't put it onto the USB device, but that's just a simple copy command away. I couldn't find an easy way to mount a USB drive in WSL2, so I'm personally living with the extra copy step for now.

@HughGrant
Copy link
Author

@Cryowatt this is actually a good solution.

@cgxeiji
Copy link

cgxeiji commented Dec 11, 2022

In WSL, you can mount the drive where pico shows on Windows. For example, if pico mounts to D:\ drive, you can do:

$ sudo mkdir -p /mnt/pico
$ sudo mount -t drvfs d: /mnt/pico

You can automate this process by creating a custom runner.sh:

#!/bin/sh
sudo mkdir -p /mnt/pico
sudo mount -t drvfs d: /mnt/pico
elf2uf2-rs -d $1

and updating your .cargo/config.toml to:

runner = "./runner.sh"

Don't forget to:

$ chmod +x runner.sh

to make it executable!

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

No branches or pull requests

3 participants