raspberrypi / pico-vscode

The official VS Code extension for Raspberry Pi Pico development. It includes several features to simplify project creation and deployment.
https://marketplace.visualstudio.com/items?itemName=raspberry-pi.raspberry-pi-pico
Mozilla Public License 2.0
131 stars 16 forks source link

Fixes openocd paths in project generation #104

Closed CarlAndersson closed 1 month ago

CarlAndersson commented 1 month ago

It seems that the bundled openocd was not used in the default project generation?

will-v-pi commented 1 month ago

This is not required - if you look in the download code, you will see that we create a symlink on MacOS and Linux for openocd.exe when downloading the bundled OpenOCD, which means the openocd.exe file should be present on all platforms.

The only supported platform that we do not provide bundled OpenOCD for at this time is Intel MacOS - the bundled OpenOCD should work on all other platforms.

CarlAndersson commented 1 month ago

Well, there was no symlink created on my system, running a Raspberry Pi 5. Where should this symlink have been?

will-v-pi commented 1 month ago

It should be next to the openocd executable, so at ~/.pico-sdk/openocd/0.12.0+dev/openocd.exe

will-v-pi commented 1 month ago

I've just double checked with the latest version of the extension and the symlink is created on my Pi 5, so I would recommend deleting the ~/.pico-sdk/openocd/ folder manually and then re-opening the project - the extension will automatically re-download OpenOCD and should add the symlink correctly

CarlAndersson commented 1 month ago

I tried removing the openocd folder and re-opening. The folder gets created, but no .exe symlink. The same if i remove the entire .pico-sdk folder. The extension reports version 0.16.2 in the extension manager.

will-v-pi commented 1 month ago

Are you using 32-bit or 64-bit Raspberry Pi OS? Note that the extension only supports 64-bit. Also, could I just confirm that the folder does contain an openocd executable and a scripts folder, just no openocd.exe symlink?

Could you also check the VS Code developer log for any errors from this extension - you can open it with Help -> Toggle Developer Tools

CarlAndersson commented 1 month ago

Yep, an openocd executable, a scripts folder, but no openocd.exe. I'm running 64-bit, uname -m returns aarch64. When I used the modified version in this pull-request the rest of the extension worked fine, as far as I can tell. I did some rudimentary logging from python in the generateProjectFiles function, so I'm positive that python could not find the openocd.exe file.

I see some errors from cmake (I think), but not from the pico extension. I pasted the log from the console below.

Details

``` INFO Started local extension host with pid 76109. log.ts:429 WARN [twxs.cmake]: Cannot register 'cmake.cmakePath'. This property is already registered. log.ts:439 ERR Ignoring cortex-debug.armToolchainPath.linux as cortex-debug.armToolchainPath is null log.ts:439 ERR Ignoring cortex-debug.armToolchainPath.osx as cortex-debug.armToolchainPath is null log.ts:439 ERR Ignoring cortex-debug.armToolchainPath.windows as cortex-debug.armToolchainPath is null log.ts:439 ERR Ignoring cortex-debug.JLinkGDBServerPath.linux as cortex-debug.JLinkGDBServerPath is null log.ts:439 ERR Ignoring cortex-debug.JLinkGDBServerPath.osx as cortex-debug.JLinkGDBServerPath is null log.ts:439 ERR Ignoring cortex-debug.JLinkGDBServerPath.windows as cortex-debug.JLinkGDBServerPath is null log.ts:439 ERR Ignoring cortex-debug.openocdPath.linux as cortex-debug.openocdPath is null log.ts:439 ERR Ignoring cortex-debug.openocdPath.osx as cortex-debug.openocdPath is null log.ts:439 ERR Ignoring cortex-debug.openocdPath.windows as cortex-debug.openocdPath is null log.ts:439 ERR Ignoring cortex-debug.pyocdPath.linux as cortex-debug.pyocdPath is null log.ts:439 ERR Ignoring cortex-debug.pyocdPath.osx as cortex-debug.pyocdPath is null log.ts:439 ERR Ignoring cortex-debug.pyocdPath.windows as cortex-debug.pyocdPath is null log.ts:439 ERR Ignoring cortex-debug.PEGDBServerPath.linux as cortex-debug.PEGDBServerPath is null log.ts:439 ERR Ignoring cortex-debug.PEGDBServerPath.osx as cortex-debug.PEGDBServerPath is null log.ts:439 ERR Ignoring cortex-debug.PEGDBServerPath.windows as cortex-debug.PEGDBServerPath is null log.ts:439 ERR Ignoring cortex-debug.stutilPath.linux as cortex-debug.stutilPath is null log.ts:439 ERR Ignoring cortex-debug.stutilPath.osx as cortex-debug.stutilPath is null log.ts:439 ERR Ignoring cortex-debug.stutilPath.windows as cortex-debug.stutilPath is null log.ts:439 ERR Ignoring cortex-debug.stlinkPath.linux as cortex-debug.stlinkPath is null log.ts:439 ERR Ignoring cortex-debug.stlinkPath.osx as cortex-debug.stlinkPath is null log.ts:439 ERR Ignoring cortex-debug.stlinkPath.windows as cortex-debug.stlinkPath is null log.ts:439 ERR Ignoring cortex-debug.stm32cubeprogrammer.linux as cortex-debug.stm32cubeprogrammer is null log.ts:439 ERR Ignoring cortex-debug.stm32cubeprogrammer.osx as cortex-debug.stm32cubeprogrammer is null log.ts:439 ERR Ignoring cortex-debug.stm32cubeprogrammer.windows as cortex-debug.stm32cubeprogrammer is null log.ts:439 ERR Extension 'ms-vscode.cpptools' CANNOT register tool without name and modelDescription: {"name":"cpptools-lmtool-configuration","toolReferenceName":"cpp","displayName":"C/C++ configuration","canBeReferencedInPrompt":true,"userDescription":"Configuration of the active C or C++ file, like language standard version and target platform.","modelDescription":"For the active C or C++ file, this tool provides: the language (C, C++, or CUDA), the language standard version (such as C++11, C++14, C++17, or C++20), the compiler (such as GCC, Clang, or MSVC), the target platform (such as x86, x64, or ARM), and the target architecture (such as 32-bit or 64-bit).","icon":"$(file-code)","when":"(config.C_Cpp.experimentalFeatures =~ /^[eE]nabled$/)","supportedContentTypes":["text/plain"]} console.ts:137 [Extension Host] do not activate console.ts:137 [Extension Host]% Object console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:52.707Z [debug] [expand] expanded ${userHome}/.pico-sdk/cmake/v3.28.6/bin/cmake console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:52.751Z [info] [proc] Executing command: /home/inciteship/.pico-sdk/cmake/v3.28.6/bin/cmake --version console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:52.771Z [warning] [proc] The command: /home/inciteship/.pico-sdk/cmake/v3.28.6/bin/cmake --version failed with error: Error: spawn /home/inciteship/.pico-sdk/cmake/v3.28.6/bin/cmake ENOENT K_i @ console.ts:137 console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:52.983Z [info] [proc] Executing command: /home/inciteship/.pico-sdk/cmake/v3.28.6/bin/cmake -E capabilities console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:52.995Z [warning] [proc] The command: /home/inciteship/.pico-sdk/cmake/v3.28.6/bin/cmake -E capabilities failed with error: Error: spawn /home/inciteship/.pico-sdk/cmake/v3.28.6/bin/cmake ENOENT K_i @ console.ts:137 console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:53.439Z [debug] [main] Safe constructing new CMakeProject instance console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:53.441Z [debug] [variant] Constructing VariantManager console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:53.444Z [debug] [main] Constructing new CMakeProject instance console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:53.446Z [debug] [main] Starting CMake Tools second-phase init console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:53.450Z [debug] [expand] expanded ${workspaceFolder} console.ts:137 [Extension Host]% Object console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:53.583Z [debug] [kit] Reading kits file /home/inciteship/.local/share/CMakeTools/cmake-tools-kits.json console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:53.923Z [info] [kit] Successfully loaded 2 kits from /home/inciteship/.local/share/CMakeTools/cmake-tools-kits.json console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:53.931Z [debug] [expand] expanded ${userHome}/.pico-sdk/cmake/v3.28.6/bin/cmake console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:53.973Z [debug] [kit] Reading kits file /home/inciteship/inciteship/audio/.vscode/cmake-kits.json console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:54.109Z [info] [kit] Successfully loaded 1 kits from /home/inciteship/inciteship/audio/.vscode/cmake-kits.json console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:54.111Z [debug] [expand] expanded ${env:HOME}/.pico-sdk/sdk/2.0.0/cmake/preload/toolchains/pico_arm_cortex_m33_gcc.cmake console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:54.116Z [debug] [expand] expanded ${userHome}/.pico-sdk/toolchain/13_2_Rel1/bin/arm-none-eabi-gcc console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:54.118Z [debug] [expand] expanded ${userHome}/.pico-sdk/toolchain/13_2_Rel1/bin/arm-none-eabi-gcc console.ts:137 [Extension Host]% Object console.ts:137 [Extension Host]% Object console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:54.385Z [info] [variant] Loaded new set of variants console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:54.387Z [debug] [main] CMakeProject instance initialization complete. console.ts:137 [Extension Host]% Object log.ts:439 ERR Ignoring cortex-debug.armToolchainPath.linux as cortex-debug.armToolchainPath is null log.ts:439 ERR Ignoring cortex-debug.armToolchainPath.osx as cortex-debug.armToolchainPath is null log.ts:439 ERR Ignoring cortex-debug.armToolchainPath.windows as cortex-debug.armToolchainPath is null log.ts:439 ERR Ignoring cortex-debug.JLinkGDBServerPath.linux as cortex-debug.JLinkGDBServerPath is null log.ts:439 ERR Ignoring cortex-debug.JLinkGDBServerPath.osx as cortex-debug.JLinkGDBServerPath is null log.ts:439 ERR Ignoring cortex-debug.JLinkGDBServerPath.windows as cortex-debug.JLinkGDBServerPath is null log.ts:439 ERR Ignoring cortex-debug.openocdPath.linux as cortex-debug.openocdPath is null log.ts:439 ERR Ignoring cortex-debug.openocdPath.osx as cortex-debug.openocdPath is null log.ts:439 ERR Ignoring cortex-debug.openocdPath.windows as cortex-debug.openocdPath is null log.ts:439 ERR Ignoring cortex-debug.pyocdPath.linux as cortex-debug.pyocdPath is null log.ts:439 ERR Ignoring cortex-debug.pyocdPath.osx as cortex-debug.pyocdPath is null log.ts:439 ERR Ignoring cortex-debug.pyocdPath.windows as cortex-debug.pyocdPath is null log.ts:439 ERR Ignoring cortex-debug.PEGDBServerPath.linux as cortex-debug.PEGDBServerPath is null log.ts:439 ERR Ignoring cortex-debug.PEGDBServerPath.osx as cortex-debug.PEGDBServerPath is null log.ts:439 ERR Ignoring cortex-debug.PEGDBServerPath.windows as cortex-debug.PEGDBServerPath is null log.ts:439 ERR Ignoring cortex-debug.stutilPath.linux as cortex-debug.stutilPath is null log.ts:439 ERR Ignoring cortex-debug.stutilPath.osx as cortex-debug.stutilPath is null log.ts:439 ERR Ignoring cortex-debug.stutilPath.windows as cortex-debug.stutilPath is null log.ts:439 ERR Ignoring cortex-debug.stlinkPath.linux as cortex-debug.stlinkPath is null log.ts:439 ERR Ignoring cortex-debug.stlinkPath.osx as cortex-debug.stlinkPath is null log.ts:439 ERR Ignoring cortex-debug.stlinkPath.windows as cortex-debug.stlinkPath is null log.ts:439 ERR Ignoring cortex-debug.stm32cubeprogrammer.linux as cortex-debug.stm32cubeprogrammer is null log.ts:439 ERR Ignoring cortex-debug.stm32cubeprogrammer.osx as cortex-debug.stm32cubeprogrammer is null log.ts:439 ERR Ignoring cortex-debug.stm32cubeprogrammer.windows as cortex-debug.stm32cubeprogrammer is null console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:55.266Z [debug] [extension] Attempting to use cache to configure workspace file:///home/inciteship/inciteship/audio console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:55.269Z [debug] [main] Not starting CMake driver: no kit selected console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:18:55.269Z [debug] [main] Unable to configure with existing cache log.ts:419 INFO [perf] Render performance baseline is 56ms console.ts:137 [Extension Host] [INFO] [raspberry-pi-pico - extension] Extension activation triggered console.ts:137 [Extension Host] [INFO] [raspberry-pi-pico - UI] Initializing UI console.ts:137 [Extension Host] [CMakeTools] 2024-10-18T14:19:04.091Z [debug] [main] Not starting CMake driver: no kit selected console.ts:137 [Extension Host] [raspberry-pi-pico] https://github.com/raspberrypi/pico-sdk.git 2.0.0 has been cloned and installed. console.ts:137 [Extension Host] [INFO] [raspberry-pi-pico - extension] Found/installed project SDK version: 2.0.0 console.ts:137 [Extension Host] [INFO] [raspberry-pi-pico - extension] Found/installed project toolchain version: 13_2_Rel1 console.ts:137 [Extension Host] [WARN] [raspberry-pi-pico - extension] CMake path in settings does not exist. Installing CMake to default path. ```

will-v-pi commented 1 month ago

Was this the log from the first run after you deleted the openocd directory? Could you also try with the latest debug build which you can download from https://github.com/raspberrypi/pico-vscode/actions/runs/11351963957 and post the logs from that (again, need the log output from the first run after deleting the openocd directory)?