Skip to content

How do I edit the command that is run at build? #183

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

Closed
NonRidiculousAdjective opened this issue Apr 2, 2025 · 3 comments
Closed

How do I edit the command that is run at build? #183

NonRidiculousAdjective opened this issue Apr 2, 2025 · 3 comments

Comments

@NonRidiculousAdjective
Copy link

On a fresh project on Nobara Linux, I tried to run the example through USB with SPI and I2C code but I am getting this output:

Executing task: /home/user/.pico-sdk/picotool/2.1.1/picotool/picotool load /home/user/Documents/Pico/PiCon/build/PiCon.elf -fx 

No accessible RP-series devices in BOOTSEL mode were found.

but:

RP2040 device at bus 3, address 5 appears to be in BOOTSEL mode, but picotool was unable to
    connect. Maybe try 'sudo' or check your permissions.

Where can I add sudo, there's a lot of config files, not sure which one contains this. I am just a little overwhelmed.

@will-v-pi
Copy link
Collaborator

will-v-pi commented Apr 3, 2025

The tasks are in .vscode/tasks.json as they're just normal VS Code tasks, so you can edit them there. But a better fix than adding sudo would be to add the udev rule from picotool (https://github.com/raspberrypi/picotool/blob/master/udev/99-picotool.rules) to your /etc/udev/rules.d/ folder (or the equivalent for your distro), which allows you to use picotool without sudo.

Edit: The udev rules are mentioned in the readme https://github.com/raspberrypi/pico-vscode?tab=readme-ov-file#linux

@NonRidiculousAdjective
Copy link
Author

Tried to add the udev rule, did not work, likely did something wrong, so I tried with sudo instead

"label": "Run Project",
            "type": "process",
            "command": "sudo ${env:HOME}/.pico-sdk/picotool/2.1.1/picotool/picotool",
            "args": [
                "load",
                "${command:raspberry-pi-pico.launchTargetPath}",
                "-fx"
            ]

Yet I am getting this error:

Executing task: sudo /home/user/.pico-sdk/picotool/2.1.1/picotool/picotool load /home/user/Documents/Pico/PiCon/build/PiCon.elf -fx 


The terminal process failed to launch: Path to shell executable "sudo /home/user/.pico-sdk/picotool/2.1.1/picotool/picotool" does not exist. 

Even though the folder and the file both exist

@will-v-pi
Copy link
Collaborator

Yes, you'll probably need to make it a shell command instead of a process, and move the args into the command - see https://code.visualstudio.com/docs/debugtest/tasks#_custom-tasks for more details on writing custom tasks in tasks.json

Also, if the udev rule is not working, try renaming it to 60-picotool.rules - see raspberrypi/picotool#199

Closing this, as we don't plan on doing anything to automatically fix this on Linux, beyond linking to the udev rules

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

2 participants