]> Git Repo - pico-vscode.git/commitdiff
Merge branch 'main' into main main
authorwill-v-pi <[email protected]>
Mon, 9 Sep 2024 13:37:58 +0000 (14:37 +0100)
committerGitHub <[email protected]>
Mon, 9 Sep 2024 13:37:58 +0000 (14:37 +0100)
1  2 
scripts/pico_project.py
src/utils/cmakeUtil.mts

diff --combined scripts/pico_project.py
index d8713ec626d4c1828127f6e552123d774e6fc90b,fb96f65779f5d353c0c0d67d8d55167c53c31e89..cb120a6aa0869cf0ca3b923be57c863d3e3ba570
@@@ -577,10 -577,7 +577,10 @@@ def GenerateCMake(folder, params)
                  f"set(sdkVersion {params['sdkVersion']})\n"
                  f"set(toolchainVersion {params['toolchainVersion']})\n"
                  f"set(picotoolVersion {params['picotoolVersion']})\n"
 -                f"include({cmakeIncPath()})\n"
 +                f"set(picoVscode {cmakeIncPath()})\n"
 +                "if (EXISTS ${picoVscode})\n"
 +                "    include(${picoVscode})\n"
 +                "endif()\n"
                  "# ====================================================================================\n"
                  )
  
@@@ -822,7 -819,7 +822,7 @@@ def generateProjectFiles(projectPath, p
              "gdbTarget": "localhost:3333",
              "gdbPath": "${{command:raspberry-pi-pico.getGDBPath}}",
              "device": "${{command:raspberry-pi-pico.getChipUppercase}}",
-             "svdFile": "{codeSdkPath(sdkVersion)}/src/${{command:raspberry-pi-pico.getChip}}/hardware_regs/${{command:raspberry-pi-pico.getChipUppercase}}.svd"
+             "svdFile": "{codeSdkPath(sdkVersion)}/src/${{command:raspberry-pi-pico.getChip}}/hardware_regs/${{command:raspberry-pi-pico.getChipUppercase}}.svd",
              "runToEntryPoint": "main",
              // Give restart the same functionality as runToEntryPoint - main
              "postRestartCommands": [
diff --combined src/utils/cmakeUtil.mts
index 0062f5e41f44b78e923fbf02c520d292979def6d,a1e4e8843500a6641b8d2610ec194f86c5f538ea..4a4c7fb841e6290d60c8473cea16e5e4cb38ceae
@@@ -11,10 -11,12 +11,12 @@@ import { rimraf, windows as rimrafWindo
  import { homedir } from "os";
  import which from "which";
  import { compareLtMajor } from "./semverUtil.mjs";
- import { picotoolVersion } from "../webview/newProjectPanel.mjs";
- import { CMAKE_DO_NOT_EDIT_HEADER_PREFIX } from "../extension.mjs";
  import { buildCMakeIncPath } from "./download.mjs";
  
+ export const CMAKE_DO_NOT_EDIT_HEADER_PREFIX =
+   // eslint-disable-next-line max-len
+   "== DO NEVER EDIT THE NEXT LINES for Raspberry Pi Pico VS Code Extension to work ==";
  export async function getPythonPath(): Promise<string> {
    const settings = Settings.getInstance();
    if (settings === undefined) {
@@@ -304,6 -306,7 +306,7 @@@ export async function cmakeUpdateSDK
    folder: Uri,
    newSDKVersion: string,
    newToolchainVersion: string,
+   newPicotoolVersion: string,
    reconfigure: boolean = true
  ): Promise<boolean> {
    // TODO: support for scaning for seperate locations of the CMakeLists.txt file in the project
          "endif()\n" +
          `set(sdkVersion ${newSDKVersion})\n` +
          `set(toolchainVersion ${newToolchainVersion})\n` +
-         `set(picotoolVersion ${picotoolVersion})\n` +
+         `set(picotoolVersion ${newPicotoolVersion})\n` +
 -        `include(${buildCMakeIncPath(false)}/pico-vscode.cmake)\n` +
 +        `set(picoVscode ${buildCMakeIncPath(false)}/pico-vscode.cmake)\n` +
 +        "if (EXISTS ${picoVscode})\n" +
 +        "    include(${picoVscode})\n" +
 +        "endif()\n" +
          // eslint-disable-next-line max-len
          "# ===================================================================================="
        );
   * Extracts the sdk and toolchain versions from the CMakeLists.txt file.
   *
   * @param cmakeFilePath The path to the CMakeLists.txt file.
-  * @returns An tupple with the [sdk, toolchain] versions or null if the file could not
+  * @returns An tupple with the [sdk, toolchain, picotool] versions or null if the file could not
   * be read or the versions could not be extracted.
   */
  export async function cmakeGetSelectedToolchainAndSDKVersions(
      }
  
      Logger.log("Updating extension lines in CMake file");
-     await cmakeUpdateSDK(folder, versionMatch[1], versionMatch2[1]);
+     await cmakeUpdateSDK(
+       folder, versionMatch[1], versionMatch2[1], versionMatch[1]
+     );
      Logger.log("Extension lines updated");
  
-     return [versionMatch[1], versionMatch2[1], picotoolVersion];
+     return [versionMatch[1], versionMatch2[1], versionMatch[1]];
    } else {
      return null;
    }
This page took 0.032907 seconds and 4 git commands to generate.