I am attempting to import this github PICO project written in C into VSCode using the "Raspberry Pi Pico" extension. VSCode is hosted on a Ubuntu computer (not a Raspberry Pi).
The result:
CMake fails to run inside of VSCode. However, if I manually perform cmake (delete & re-create the build directory and run cmake from within the build directory), VSCode will then successfully compile the project and flash the PICO. However, after flashing the PICO, VSCode fails at starting the debugging session. Since I can run cmake manually, I would like to solve successfully debugging the C code on the PICO first.
Some background:
Using the command line, I can run cmake (as mentioned above) on the above linked to github project, run make, start OpenOCD and program the PICO and connect a instance of GDB-MULTIARCH to the OpenOCD server.
For all programming and debugging, I am using a "Raspberry Pi Debug Probe". For all testing, the target PICO is a PICO W.
To verify the VSCode installation and PICO related development tools the "blink" example project from the "Raspberry Pi Pico" VSCode integration was opened in VSCode and was successfully programmed into the PICO.
More background:
When starting out, I didn't know how VSCode worked. So here are some observations I have made to help any who would like to contribute. VSCode needs a directory in the project's root directory called .vscode. Inside are about half a dozen JSON file which direct VSCode on matters such as where the development tools are located, how to run cmake, ect. Instead of creating this from scratch, a VSCode "Integration" called "Raspberry Pi Pico" was created to import (adapting) existing PICO project into VSCode. And, by doing so, creates the .vscode directory and all the necessary JSON files within it. The content of these JSON files depends on many things. Some I am still trying to understand. Among them, the platform VSCode is running on might be a Windows, Linux, Mac or Rraspberry Pi.
The VSCode About output:
Version: 1.96.4
Commit: cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba
Date: 2025-01-16T00:16:19.038Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Linux x64 6.8.0-51-generic snap
There is a lot of data in log files. Instead of dumping them all here, leave a comment as to what might help and I'll modify this question.
.jsonconfig files, both in your.vscodeproject directory and the normal config in~/.config/VSCodeall have to work together to provide integration. I have all header and library integration working, but haven't tried the build or debug within.CMakeLists.txtfile, but I looked at the file from the Bricpico repo you linked to, and nothing stands out. I'll have time in an hour or so to launch vscode and attach a pair of picos.