Quantcast
Viewing all articles
Browse latest Browse all 5391

General • Re: Raspberry Pi 5 setup for PICO/C development with VScode

Okay, now after I have figured out on how everything works, here are the instructions.

Background:
The documentation is not consistent. It installs the raspberry-pi-pico extension, but you MUST NOT use the extensions with the pico-examples directory.
After having that clear, the rest just works, if you do minimal adjustments.
Remark: The extension works well to create your own projects and you can even clone individual examples from the pico-examples to test them, but do never import pico-examples into raspberry-pi-pico project. It will make it unusable. So at best leave the pico-examples directory untouched by this extension.

Now here is the howto for getting everything to work with the PI5.
The original files referenced by the documentation in pico-examples/ide/vscode are not going to work on a raspberry PI 5.

So I created a new set of .vscode files, that are now universally working with PI4 and PI5. However you need to also have another file in the top folder of pico-examples to instruct openocd on the right interface.

I also added two tasks, that are very handy.
  • Build
  • Flash
Instructions:
  1. download the attached .zip file to your PI5 and unpack somewhere (in this example ~/pi5_vscode_setup.
    There are three .json files in there, which go into .vscode folder and a .cfg file which goes into the main directory.
  2. Run the normal installer (pico_setup.sh) as outlined in the "Getting started with Raspberry Pi Pico" documentation.
  3. Do not start vscode yet.
  4. create a .vscode folder inside pico-examples:

    Code:

    mkdir ~/pico/pico-examples/.vscode
  5. copy the three .json files into the newly created .vscode folder

    Code:

    cp ~/pi5_vscode_setup/.vscode/*.json ~/pico/pico-examples/.vscode
  6. copy raspberrypi-swd.cfg into pico-examples folder top directory

    Code:

    cp ~/pi5_vscode_setup/raspberrypi-swd.cfg ~/pico/pico-examples/


This has done the following:
  • added the two tasks and also defined the default key binding to FLASH with CTRL+SHIFT+B
  • corrected the openocd configuration to be universal correct with PI4 and PI5.
  • changed the visibility of some of the CMAKE debug options in the status bar (settings.json)
You also may want to add a user-defined key binding to run the Flash command (I choose for me ALT+SHIFT+R, as in run).

For that you need to edit ~/.config/Code/user/keybindings.json and put in:

Code:

// Place your key bindings in this file to override the defaults[    {        "key": "alt+shift+R",        "command": "workbench.action.tasks.runTask",        "args": "Flash",        "when": "!inDebugMode"    }]
Pi5-files.zip

Statistics: Posted by SerErris — Fri May 10, 2024 12:55 pm



Viewing all articles
Browse latest Browse all 5391

Trending Articles