@@ -746,9 +746,10 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger,
746
746
use_home_var = f"{ user_home } /.pico-sdk" in ninjaPath
747
747
748
748
openocd_path = ""
749
+ server_path = "\n \" serverpath\" " # Because no \ in f-strings
749
750
openocd_path_os = Path (user_home , relativeOpenOCDPath (openOCDVersion ).replace ("/" , "" , 1 ), "bin" , "openocd.exe" )
750
751
if os .path .exists (openocd_path_os ):
751
- openocd_path = f'\n "serverpath": " { codeOpenOCDPath (openOCDVersion )} /bin/openocd.exe", '
752
+ openocd_path = f'{ codeOpenOCDPath (openOCDVersion )} /bin/openocd.exe'
752
753
753
754
for p in projects :
754
755
if p == 'vscode' :
@@ -761,7 +762,8 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger,
761
762
"executable": "${{command:raspberry-pi-pico.launchTargetPath}}",
762
763
"request": "launch",
763
764
"type": "cortex-debug",
764
- "servertype": "openocd",{ openocd_path }
765
+ "servertype": "openocd",\
766
+ { f'{ server_path } : "{ openocd_path } ",' if openocd_path else "" }
765
767
"gdbPath": "{ gdbPath } ",
766
768
"device": "RP2040",
767
769
"configFiles": [
@@ -776,7 +778,7 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger,
776
778
"continue"
777
779
],
778
780
"openOCDLaunchCommands": [
779
- "adapter speed 1000 "
781
+ "adapter speed 5000 "
780
782
],
781
783
"preLaunchTask": "Compile Project"
782
784
}},
@@ -808,11 +810,10 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger,
808
810
"MIMode": "gdb",
809
811
"miDebuggerPath": "{ gdbPath } ",
810
812
"miDebuggerServerAddress": "localhost:3333",
811
- "debugServerPath": "openocd",
812
- "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \\ "adapter speed 1000 \\ "",
813
+ "debugServerPath": "{ openocd_path if openocd_path else " openocd" } ",
814
+ "debugServerArgs": "-f { debugger } -f target/rp2040.cfg -c \\ "adapter speed 5000 \\ "",
813
815
"serverStarted": "Listening on port .* for gdb connections",
814
816
"filterStderr": true,
815
- "stopAtEntry": true,
816
817
"hardwareBreakpoints": {{
817
818
"require": true,
818
819
"limit": 4
@@ -923,6 +924,21 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger,
923
924
"windows": {{
924
925
"command": "{ ninjaPath .replace (user_home , "${env:USERPROFILE}" ) if use_home_var else ninjaPath } .exe"
925
926
}}
927
+ }},
928
+ {{
929
+ "label": "Flash",
930
+ "type": "process",
931
+ "dependsOn": "Compile Project",
932
+ "command": "{ openocd_path if openocd_path else "openocd" } ",
933
+ "args": [
934
+ "-f",
935
+ "{ debugger } ",
936
+ "-f",
937
+ "target/rp2040.cfg",
938
+ "-c",
939
+ "adapter speed 5000; program ${{command:raspberry-pi-pico.launchTargetPath}} verify reset exit"
940
+ ],
941
+ "problemMatcher": []
926
942
}}
927
943
]
928
944
}}
0 commit comments