]> Git Repo - pico-vscode.git/commitdiff
Add getChipUppercase command, for use in launch.json
authorWilliam Vinnicombe <[email protected]>
Mon, 26 Aug 2024 17:49:03 +0000 (18:49 +0100)
committerWilliam Vinnicombe <[email protected]>
Mon, 26 Aug 2024 17:49:03 +0000 (18:49 +0100)
Fixes #58

package.json
scripts/pico_project.py
src/commands/getPaths.mts
src/extension.mts

index 1d71012d0cc9c7daef35d08351d51a8b93b3b7ce..4250dc1089a583876dae0cad5afa5731ad256026 100644 (file)
         "category": "Raspberry Pi Pico",
         "enablement": "false"
       },
+      {
+        "command": "raspberry-pi-pico.getChipUppercase",
+        "title": "Get Chip Uppercase",
+        "category": "Raspberry Pi Pico",
+        "enablement": "false"
+      },
       {
         "command": "raspberry-pi-pico.getTarget",
         "title": "Get OpenOCD Target",
index 162347bc5b87dc2ddaaaeb4de7d8c06c25fc5754..10763660a18f8d7ee6c59c207456b66b9d6ee3f5 100644 (file)
@@ -785,12 +785,12 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger,
             "servertype": "openocd",\
 {f'{server_path}: "{openocd_path}",' if openocd_path else ""}
             "gdbPath": "${{command:raspberry-pi-pico.getGDBPath}}",
-            "device": "${{command:raspberry-pi-pico.getChip}}",
+            "device": "${{command:raspberry-pi-pico.getChipUppercase}}",
             "configFiles": [
                 "{debugger}",
                 "target/${{command:raspberry-pi-pico.getTarget}}.cfg"
             ],
-            "svdFile": "{codeSdkPath(sdkVersion)}/src/${{command:raspberry-pi-pico.getChip}}/hardware_regs/${{command:raspberry-pi-pico.getChip}}.svd",
+            "svdFile": "{codeSdkPath(sdkVersion)}/src/${{command:raspberry-pi-pico.getChip}}/hardware_regs/${{command:raspberry-pi-pico.getChipUppercase}}.svd",
             "runToEntryPoint": "main",
             // Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
             // Also works fine for flash binaries
@@ -811,8 +811,8 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger,
             "servertype": "external",
             "gdbTarget": "localhost:3333",
             "gdbPath": "${{command:raspberry-pi-pico.getGDBPath}}",
-            "device": "${{command:raspberry-pi-pico.getChip}}",
-            "svdFile": "{codeSdkPath(sdkVersion)}/src/${{command:raspberry-pi-pico.getChip}}/hardware_regs/${{command:raspberry-pi-pico.getChip}}.svd",
+            "device": "${{command:raspberry-pi-pico.getChipUppercase}}",
+            "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": [
@@ -838,7 +838,7 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger,
                 "limit": 4
             }},
             "preLaunchTask": "Flash",
-            "svdPath": "{codeSdkPath(sdkVersion)}/src/${{command:raspberry-pi-pico.getChip}}/hardware_regs/${{command:raspberry-pi-pico.getChip}}.svd"
+            "svdPath": "{codeSdkPath(sdkVersion)}/src/${{command:raspberry-pi-pico.getChip}}/hardware_regs/${{command:raspberry-pi-pico.getChipUppercase}}.svd"
         }},
     ]
 }}
index 4400d92b2905414595704cd5991407b2599ee918..5f76edca50595e0fb4e8fc85175e095706157c1f 100644 (file)
@@ -152,6 +152,19 @@ export class GetChipCommand extends CommandWithResult<string> {
   }
 }
 
+export class GetChipUppercaseCommand extends CommandWithResult<string> {
+  constructor() {
+    super("getChipUppercase");
+  }
+
+  async execute(): Promise<string> {
+    const cmd = new GetChipCommand();
+    const chip = await cmd.execute();
+
+    return chip.toUpperCase();
+  }
+}
+
 export class GetTargetCommand extends CommandWithResult<string> {
   constructor() {
     super("getTarget");
index 9f13c5384fdc51f80ef4599eb12d7af16e178000..d8eabeee151fd3959b8c5803d273c5442c8b2b6c 100644 (file)
@@ -37,6 +37,7 @@ import {
   GetGDBPathCommand,
   GetChipCommand,
   GetTargetCommand,
+  GetChipUppercaseCommand,
 } from "./commands/getPaths.mjs";
 import {
   downloadAndInstallCmake,
@@ -103,6 +104,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
     new GetEnvPathCommand(),
     new GetGDBPathCommand(),
     new GetChipCommand(),
+    new GetChipUppercaseCommand(),
     new GetTargetCommand(),
     new CompileProjectCommand(),
     new RunProjectCommand(),
This page took 0.038751 seconds and 4 git commands to generate.